my calculations are as below.
Base = Sum( mydf[amount])
Function1 = Calculate([Base],....)
Function2 = Calculate([Base],....)
Function3 = Calculate([Base],....)
Total = Function1 + Function2 + Function3
I would like change my Base functions as follows
Base_1 = SUMX( mydf, mydf[amount]*1 )
Base_2 = SUMX( mydf, mydf[amount]*2 )
and save them as Total_1 and Total_2
If I wanna change the base function only once, I would just change it and I would write Total_1
instead of Total
.
But how can i store it, if i wanna change the base twice ?
many thanks in advance.
Power BI has calculation groups for exactly this scenario. Imagine you have a sales measure and want MTD, QTD and YTD variations. You could create 3 additional measures but what if you now need to do the same for purchases. You would then need 8 measures in total. Calculation groups allow you to do this with your two base measures and then a MTD, QTD, YTD variation placed on top automatically.
It is hard to provide exact code without a data model and an exact definition of all your measures but the following guides should be enough to get you started.