Forum Discussion
Ideas for Calculations
- Anonymous2 years ago
Hi KIL2022 ,
According to your description, here are my steps you can follow as a solution.
(1) This is my test data.
(2) We can create a table.
Table 2 = VALUES('Table'[Date])(3) We can create measures.
Measure = var _a= MAXX(FILTER(ALL('Table 2'),'Table 2'[Date]<MAX('Table 2'[Date])),[Date]) var _b=CALCULATE(SUM('Table'[Qty]),FILTER(ALL('Table'), 'Table'[Z0]=MAX('Table'[Z0]) && 'Table'[Z1]=MAX('Table'[Z1]) && 'Table'[Costumer]=MAX('Table'[Costumer]) && 'Table'[Item]=MAX('Table'[Item]) && [Date]=_a )) var _c=CALCULATE(SUM('Table'[Qty]),FILTER(ALL('Table'), 'Table'[Z0]=MAX('Table'[Z0]) && 'Table'[Z1]=MAX('Table'[Z1]) && 'Table'[Costumer]=MAX('Table'[Costumer]) && 'Table'[Item]=MAX('Table'[Item]) && [Date]=MAX('Table 2'[Date] ))) return IF(_c=BLANK(),_b,_c)Measure 2 = IF(ISINSCOPE('Table'[Costumer]),SUMX(VALUES('Table'[Item]),[Measure]))(4) Then the result is as follows.
If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi KIL2022 ,
According to your description, here are my steps you can follow as a solution.
(1) This is my test data.
(2) We can create a table.
Table 2 = VALUES('Table'[Date])
(3) We can create measures.
Measure =
var _a= MAXX(FILTER(ALL('Table 2'),'Table 2'[Date]<MAX('Table 2'[Date])),[Date])
var _b=CALCULATE(SUM('Table'[Qty]),FILTER(ALL('Table'), 'Table'[Z0]=MAX('Table'[Z0]) && 'Table'[Z1]=MAX('Table'[Z1]) && 'Table'[Costumer]=MAX('Table'[Costumer]) && 'Table'[Item]=MAX('Table'[Item]) && [Date]=_a ))
var _c=CALCULATE(SUM('Table'[Qty]),FILTER(ALL('Table'), 'Table'[Z0]=MAX('Table'[Z0]) && 'Table'[Z1]=MAX('Table'[Z1]) && 'Table'[Costumer]=MAX('Table'[Costumer]) && 'Table'[Item]=MAX('Table'[Item]) && [Date]=MAX('Table 2'[Date] )))
return IF(_c=BLANK(),_b,_c)Measure 2 = IF(ISINSCOPE('Table'[Costumer]),SUMX(VALUES('Table'[Item]),[Measure]))
(4) Then the result is as follows.
If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.