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.
Was trying to display cummulative count of the id by months but i have almost 3+ yrs data but i need to show last 6 month trend.
If i do filter on
Solved! Go to Solution.
Hi @Sarath5c8 ,
There is something wrong in parry2k's code. I suggest you to try this measure to achieve your goal.
id_Cum_Cnt =
VAR __within6months =
DATEDIFF (
MIN ( 'tst'[CREATE_DATE] ),
EOMONTH ( MAXX ( ALL ( tst ), tst[CREATE_DATE] ), 0 ),
MONTH
) < 6
RETURN
IF (
__within6months,
CALCULATE (
'tst'[id_count],
FILTER ( ALL ( 'tst' ), 'tst'[CREATE_DATE] <= MAX ( 'tst'[CREATE_DATE] ) )
)
)
My Sample has data from 2020/01/01 to 2022/08. Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Sarath5c8 ,
There is something wrong in parry2k's code. I suggest you to try this measure to achieve your goal.
id_Cum_Cnt =
VAR __within6months =
DATEDIFF (
MIN ( 'tst'[CREATE_DATE] ),
EOMONTH ( MAXX ( ALL ( tst ), tst[CREATE_DATE] ), 0 ),
MONTH
) < 6
RETURN
IF (
__within6months,
CALCULATE (
'tst'[id_count],
FILTER ( ALL ( 'tst' ), 'tst'[CREATE_DATE] <= MAX ( 'tst'[CREATE_DATE] ) )
)
)
My Sample has data from 2020/01/01 to 2022/08. Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Sarath5c8 first and foremost when you are working with dates, it is a best practice to add a calendar dimension to your model, you can check the time intelligence series on my YouTube channel https://www.youtube.com/watch?v=BKzsCfr4qeQ&list=PLiYSIjh4cEx2FkuGkngYruS0wm8MYFsoi&index=12
to return blank prior to 6 months, you can do something like this:
d_Cum_Cnt =
VAR __within6months = DATEDIFF ( MAX ( MAX ('tst'[CREATE_DATE] ), TODAY (), Month ) >= 6
RETURN
IF ( __within6months ),
CALCULATE(
'tst'[id_count],
FILTER(
ALL('tst),
'tst'[CREATE_DATE] <= MAX ('tst'[CREATE_DATE])
)
)
)
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
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 |
---|---|
111 | |
95 | |
80 | |
68 | |
59 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |