Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hi Experts
I have a cumulative count measure that works, but now I need to do the same cumulative count for the same period last year and I am unable to get it
Can someone please help?
Cumulative Count = CALCULATE(COUNT(Tbl_Data_Register[ENTRY NUMBER]), FILTER(ALLSELECTED(Tbl_Data_Register),Tbl_Data_Register[DATE RAISED] <= MAX('Calendar'[Date])))
I have tried the below with no luck
Cumulative Count SPLY =
CALCULATE(
COUNT(Tbl_Data_Register[ENTRY NUMBER]),
FILTER(
ALLSELECTED(Tbl_Data_Register),Tbl_Data_Register[DATE RAISED]),
'Calendar'[Date] <= MAX('Calendar'[Date]) &&
'Calendar'[Date] >= MIN(DATESBETWEEN('Calendar'[Date], SAMEPERIODLASTYEAR('Calendar'[Date]), MAX('Calendar'[Date])))
)
)
Regards
Rah
Solved! Go to Solution.
@rahul_ferns Use ALL instead of ALLSELECTED in the syntax also make sure calendar table and your data table have dates before 1 year. Also make sure tha the join date column should not have any timestamp. Like this:
Cumulative Count SPLY = var _date = MAX('Calendar'[Date])
var _max = date(year(_date)-1,month(_date),day(_date))
return
CALCULATE(CALCULATE(COUNT(Tbl_Data_Register[ENTRY NUMBER]), FILTER(ALL(Calendar),Calendar[Date] <= _max)))
You can follow the link below for more information regarding this issue:
If this helps you, please mark it as an accepted solution to help other users find it more easily.
@rahul_ferns Use ALL instead of ALLSELECTED in the syntax also make sure calendar table and your data table have dates before 1 year. Also make sure tha the join date column should not have any timestamp. Like this:
Cumulative Count SPLY = var _date = MAX('Calendar'[Date])
var _max = date(year(_date)-1,month(_date),day(_date))
return
CALCULATE(CALCULATE(COUNT(Tbl_Data_Register[ENTRY NUMBER]), FILTER(ALL(Calendar),Calendar[Date] <= _max)))
You can follow the link below for more information regarding this issue:
If this helps you, please mark it as an accepted solution to help other users find it more easily.
Thanks, devesh
you can try one of the following two solutions and replace your measures:Solution1:
Cumm Sales = var _date = max('Date'[date])
Var _max = date(year(_date)-1, month(_date), day(_date))
return
CALCULATE(SUM(Sales[Sales Amount]),filter(all('Date'),'Date'[date] <= _max))
Solution2:
Cumm Sales = var _date = max('Date'[date])
Var _max = date(year(_date)-1, month(_date), day(_date))
return
CALCULATE(SUM(Sales[Sales Amount]),filter(allselected(date),date[date] <=_max))
If this helps you, mark it as an accepted solution to help other members find it more easily.
@devesh_gupta tried it with no luck. Getting no error, just blank column
Cumulative Count SPLY = var _date = MAX('Calendar'[Date])
var _max = date(year(_date)-1,month(_date),day(_date))
return
CALCULATE(CALCULATE(COUNT(Tbl_Data_Register[ENTRY NUMBER]), FILTER(ALLSELECTED(Tbl_Data_Register),Tbl_Data_Register[DATE RAISED] <= _max)))Tried changing to below with no luck. Again no erro, just blank column
Cumulative Count SPLY = var _date = MAX('Calendar'[Date])
var _max = date(year(_date)-1,month(_date),day(_date))
return
CALCULATE(CALCULATE(COUNT(Tbl_Data_Register[ENTRY NUMBER]), FILTER(ALLSELECTED(Calendar),Calendar[Date] <= _max)))
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.
| User | Count |
|---|---|
| 48 | |
| 46 | |
| 41 | |
| 20 | |
| 17 |
| User | Count |
|---|---|
| 70 | |
| 67 | |
| 32 | |
| 27 | |
| 26 |