I'm just starting using Powerpivot, and my first application raised some harder problems that I would have thought... Here is my problem:
I have 3 tables: factRepairs; factCorss; dimSpares
factRepairs:
factCross
dimSpares
factRepairs is linked to factCross by a relationship between the Repair column, and factCross is linked to dimSpares through Spare ID <->Spare
I want to add a calculated column (or measure, not sure at this stage) to give the cost of spares used for one repair.
I've been looking for solution for a while but I didn't manage to figure it out... If someone can guide me through a formula to do this it would be greatly appreciated!
Thanks,
You are right to think that many-to-many is an non-trivial problem in PowerPivot!
The good news is that this is probably more of a data structure issue than a pure underlying many to many situation and can be easily solved with a calculated column on the factCross
table. This works a bit like a SUMIF in excel and doesn't require a relationship:
= CALCULATE(SUM(dimSpares[price]),
FILTER(dimSpares,
dimSpares[id] = EARLIER([spare id])
)
)
You can then write a measure/calculated field to sum the cost and if you create a relationship between factRepairs
and factCross
you should be in business.
If you are looking for a more sophisticated way to deal with these problems then try the Many to Many revolution but honestly that's about as complex as DAX gets so I would concentrate on simpler stuff :-)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.