The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hello All,
I am trying to calculate the running count of months selected between two dates using relative date filter.
I have used below dax which gives me the running count of months between two dates
MonthCount =
CALCULATE (
COUNTROWS(VALUES(VW_Supplier_Scorecard[yrmnth_nw])),
FILTER (
ALLSELECTED(VW_Supplier_Scorecard),
'VW_Supplier_Scorecard'[yrmnth_nw] <= MAX(VW_Supplier_Scorecard[yrmnth_nw])
)
)
But In my same report, i need to have month year filter as well where i could able to filter month wise.
Now when i filter from Year Month slicer, then it is giving me only that month count.
But i am expecting the running count value should be returned.
Here I have filtered Nov 22, it is returning 1, but i am expecting it to return as 15.
Can anyone help me please.
Thanks,
Mohan V.
Can anyone please help me with this.
@MohanVanks , with help from date table
Cumm Sales = CALCULATE(SUM(Sales[Sales Amount]),filter(all('Date'),'Date'[date] <=max('Date'[date])))
Cumm Sales = CALCULATE(SUM(Sales[Sales Amount]),filter(allselected(date),date[date] <=max(date[Date])))
or window function
Power BI Window function Rolling, Cumulative/Running Total, WTD, MTD, QTD, YTD, FYTD: https://youtu.be/nxc_IWl-tTc
@amitchandak i tried the dax which you given using date master table, but it gives the running count of year-month column
VAR minDate =
CALCULATE (
MIN ( 'DateMaster'[Date] ),
ALLSELECTED( 'DateMaster' )
)
RETURN
CALCULATE (
DISTINCTCOUNT(DateMaster[Year Month]),
FILTER (
ALL ( 'DateMaster' ),
'DateMaster'[Date] >= minDate
&& 'DateMaster'[Date] <= MAX ( 'DateMaster'[Date] )
)
)
But when i filter with Year month, then it gives the same result as above in my ask as 1.
Can you please help me here.
Thanks,
Mohan V.
@amitchandak thanks for the reply.
In my case, i do not have any date table, and i shouldnt be using it for some reasons.
Can you please suggest/guide me for the same without date table.
Thanks,
Mohan V.
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
111 | |
80 | |
78 | |
43 | |
37 |
User | Count |
---|---|
158 | |
111 | |
64 | |
59 | |
54 |