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 there,
I'm facing a problem with a DAX formula that compute a cumulative SUM for my sales of cycles.
I got a simple dataset SalesByCycle, with the following columns :
Date is Date column
Cycle is a category of our products
Sales is the amount sold
I got a Date slicer, and a Cycle Slicer that let me chose 1 or several Cycles.
The problem is : the categorization of the cumulative SUM doesn't work when I select more than one cycle.
Here is the result when I select only one cycle (cycle 1 there) : everything is fine
Abd the result when I select all cycles (or 2 or 3) : the provessive SUM doesn't work (each Cycle that have data on this day have the same value : the grand total of the cumulation at this date)
Here is the DAX code of my cumulative SUM :
ActualSalesByCycle =
var DateValue = MAX(SalesByCycle[Date])
var CyclesValues = ALLSELECTED(SalesByCycle[Cycle])
RETURN
CALCULATE( SUM(SalesByCycle[Sales]), FILTER(ALL(SalesByCycle), SalesByCycle[Date] <= DateValue && SalesByCycle[Cycle] IN CyclesValues ) )
Thank you
Solved! Go to Solution.
Hi @NeimadB ,
Here is my sample:
Please try:
ActualSalesByCycle =
var DateValue = MAX(SalesByCycle[Date])
RETURN
CALCULATE( SUM(SalesByCycle[Sales]), FILTER(ALL(SalesByCycle), SalesByCycle[Date] <= DateValue && SalesByCycle[Cycle] =SELECTEDVALUE(SalesByCycle[Cycle]) ) )
Final output:
Best Regards,
Jianbo Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @NeimadB ,
Here is my sample:
Please try:
ActualSalesByCycle =
var DateValue = MAX(SalesByCycle[Date])
RETURN
CALCULATE( SUM(SalesByCycle[Sales]), FILTER(ALL(SalesByCycle), SalesByCycle[Date] <= DateValue && SalesByCycle[Cycle] =SELECTEDVALUE(SalesByCycle[Cycle]) ) )
Final output:
Best Regards,
Jianbo Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
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 |
---|---|
97 | |
96 | |
81 | |
74 | |
66 |
User | Count |
---|---|
126 | |
106 | |
105 | |
86 | |
72 |