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.
Hello All,
I'm having sales data for months by products.I want to calclulate cumulative of sales for N months ,if the months have positive sales.Month Selection is dynamic.In my case i'm considering for 3 months.
Solved! Go to Solution.
Hi @Likhitha ,
We can create a meausre as below.
Measure =
VAR ed =
EDATE ( MAX ( 'Current Year'[Date] ), -3 )
VAR d =
MAX ( 'Current Year'[Date] )
RETURN
CALCULATE (
SUM ( 'Current Year'[Total Customer] ),
FILTER (
ALLSELECTED ( 'Current Year' ),
'Current Year'[Date] > ed
&& 'Current Year'[Date] <= d
&& 'Current Year'[Total Customer] >= 0
)
)
Hello All,
Thank you so much for your solutions.
I created some DAX and got the solution.
Hi @Likhitha ,
We can create a meausre as below.
Measure =
VAR ed =
EDATE ( MAX ( 'Current Year'[Date] ), -3 )
VAR d =
MAX ( 'Current Year'[Date] )
RETURN
CALCULATE (
SUM ( 'Current Year'[Total Customer] ),
FILTER (
ALLSELECTED ( 'Current Year' ),
'Current Year'[Date] > ed
&& 'Current Year'[Date] <= d
&& 'Current Year'[Total Customer] >= 0
)
)
Hi @Likhitha ,
Use the below measure to your calculation:
Cumulative = CALCULATE([Total],FILTER(ALLSELECTED(Table1),Table1[Month Num] <= MAX(Table1[Month Num])))
Don't forget to hit Thumbs up and accept this as a solution if you find it helpful!
@Tahreem24 In my case , if i select december month the cumulative sum should happen only if my november and october months have positive values,otherwise the product should be ignored.(I'm doing cumulative for 3 months).
Attached screen shot for your reference:
Please give KUDOS for support! 😊
Please try below measure:
@Tahreem24 In that DAX,how can i check that each month sales value is positive only??
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 |
---|---|
110 | |
100 | |
80 | |
64 | |
58 |
User | Count |
---|---|
148 | |
111 | |
94 | |
84 | |
67 |