Forum Discussion
Calculate delta between 2 rows and multiply by another cell
- 4 years ago
- 4 years ago
Hi, carinatina_pbi ;
You could create measures as follows:
Col 1 = MAX('Ticket'[Amount])*CALCULATE(MAX('Exchange rate'[Delta 1]),FILTER(ALL('Ticket'),EOMONTH([Period Month],0)=EOMONTH(MAX('Ticket'[Period Month]),1)))Col 2 = MAX('Ticket'[Amount])*CALCULATE(MAX('Exchange rate'[Delta 2]),FILTER(ALL('Ticket'),EOMONTH([Period Month],0)=EOMONTH(MAX('Ticket'[Period Month]),2)))Col 3 = MAX('Ticket'[Amount])*CALCULATE(MAX('Exchange rate'[Delta 3]),FILTER(ALL('Ticket'),EOMONTH([Period Month],0)=EOMONTH(MAX('Ticket'[Period Month]),3)))Col 4 = MAX('Ticket'[Amount])*CALCULATE(MAX('Exchange rate'[Delta 4]),FILTER(ALL('Ticket'),EOMONTH([Period Month],0)=EOMONTH(MAX('Ticket'[Period Month]),4)))Col 4 = MAX('Ticket'[Amount])*CALCULATE(MAX('Exchange rate'[Delta 4]),FILTER(ALL('Ticket'),EOMONTH([Period Month],0)=EOMONTH(MAX('Ticket'[Period Month]),4)))total sum = MAXX(FILTER(ALL('Ticket'),EOMONTH([Period Month],0)=EOMONTH(MAX('Ticket'[Period Month]),-1)),[Col 1])+MAXX(FILTER(ALL('Ticket'),EOMONTH([Period Month],0)=EOMONTH(MAX('Ticket'[Period Month]),-2)),[Col 2])+MAXX(FILTER(ALL('Ticket'),EOMONTH([Period Month],0)=EOMONTH(MAX('Ticket'[Period Month]),-3)),[Col 3])+MAXX(FILTER(ALL('Ticket'),EOMONTH([Period Month],0)=EOMONTH(MAX('Ticket'[Period Month]),-4)),[Col 4])+MAXX(FILTER(ALL('Ticket'),EOMONTH([Period Month],0)=EOMONTH(MAX('Ticket'[Period Month]),-5)),[Col 5])Real Dif.Monthly = [Monthly Diff.]-([total sum]-SUMX(FILTER(ALL(Ticket),EOMONTH([Period Month],0)=EOMONTH(MAX('Ticket'[Period Month]),-1)),[total sum]))Real Dif.Monthly = [Monthly Diff.]-([total sum]-SUMX(FILTER(ALL(Ticket),EOMONTH([Period Month],0)=EOMONTH(MAX('Ticket'[Period Month]),-1)),[total sum]))The final output is shown below:
Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
In this link you will find the excel with all formulas in tab Results:
Thanks for your help.
KR,
Carina
- carinatina_pbi4 years agoFrequent Visitor
- Ashish_Mathur4 years ago
Super User
You are welcome.
- carinatina_pbi4 years agoFrequent Visitor
Do you see any other way to calculate my target columns below, without creating several columns (Delta's and Col's)? Because I can have tickets with 30 lines, then based on this proposal solution I will need to create 30 Delta's columns and also 30 Col's columns, and I tried with 10 and PBI is running for a log time calculating it.
Thanks for your help again in advance.
KR,
Carina