Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi,
I need to get the product of the previous record multiplied by current percentage with DAX.
The dax formula should return the value in the 'Calculation' column. The 'Formula' column shows how the calculation is done in Excel.
B | C | D | E | |
2 | Periods | Percentage | Calculation | Formula |
3 | 1 | 0,99 | 0,990 | =C3 |
4 | 2 | 0,98 | 0,970 | =+C4*D3 |
5 | 3 | 0,99 | 0,960 | =+C5*D4 |
I think that the productx function should be used to do this but I can´t find how.
This has to be a pretty common calculation, I would appreciate if anyone who dealt with this too could give me a hint.
Thanks,
Robert
Solved! Go to Solution.
Hi,
I have been testing several ways and this does it:
PRODUCTX( filter(ALL(Table1[Periods]) ; Table1[Periods]<= MIN(Table1[Periods])) ; Table1[Percentage_] )
@Mariusz thanks for you help
best regards
Hi @vdburg
The below will address your issues.
Product x = VAR _AllPreviousPeriods = FILTER( ALL( YourTable ), YourTable[Periods] <= MAX( YourTable[Periods] ) ) RETURN PRODUCTX( _AllPreviousPeriods, YourTable[Percentage] )
Hi @Mariusz ,
It did work, however if I add a dimension like 'year' it fails. Do you know of any workaround?
Hi @vdburg
You need to replace 'Table1' with Calendar Table / Date Dimension
Like below.
Product x = VAR _AllPreviousPeriods = FILTER( ALL( Calendar ), Calendar[Date] <= MAX( Calendar[Date] ) ) RETURN PRODUCTX( _AllPreviousPeriods, YourTable[Percentage] )
How would you do this is the % return were a measure from two separate tables sliced down to get the % return? Then continuously multiply the %returns down each row to get a cummulative %return?
Hi @Mariusz ,
I think that unfortunately this approach won´t work because I used a simple example, but I will need to do the calculation with many more dimensions and perform the calculation grouping and degrouping over dimensions.
For example I got this table detailing percentage churn by year and region.
But I will also need to agregate the years together:
Many thanks
Hi @vdburg
Looking at your example, how would you wont the product to xcalculated, over year and month but with in the region?
Many Thanks
Mariusz
Hi,
I have been testing several ways and this does it:
PRODUCTX( filter(ALL(Table1[Periods]) ; Table1[Periods]<= MIN(Table1[Periods])) ; Table1[Percentage_] )
@Mariusz thanks for you help
best regards
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
112 | |
97 | |
84 | |
67 | |
59 |
User | Count |
---|---|
150 | |
120 | |
99 | |
87 | |
68 |