Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
I've been reading up on similar ish post but not found something as basic as this.
I am trying to count up number of records in a table, but only for the previous year. My DAX syntax seems correct but returns 'blank' so it's not working. My dax is:
Request Count (prev yr) = CALCULATE(COUNT('RequestList'[Reference]),PREVIOUSYEAR('RequestList'[RequestDate]))
Is this the wrong approach? Why wouldn't this work?
thanks
Solved! Go to Solution.
@rogerdea , Please use date table in all such cases.
Refer thsese examples and blog
YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31"))
Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))
This year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR('Date'[Date]),"12/31"))
Last year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year)),"12/31"))
Last to last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-2,Year),"12/31"))
Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))
Power BI — Year on Year with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.
I had a similar issue and your examples helped me through it. Thanks!
Thanks both, i've managed to get the monthly breakdown for last year's requests showing on a visual by doing :
Request Count (previous year) = CALCULATE(COUNT('RequestList'[Reference]),SAMEPERIODLASTYEAR('Date table'[Date]))
But i can't get the current year's measure working. When i add it to the visual it's showing the total count value per month for all years. My measure for this is:
Request Count (current yr) = CALCULATE(COUNT('RequestList'[Reference]),DATESYTD(ENDOFMONTH('Date table'[Date]),"12/31"))
Any idea why?
First make sure, you have propert Date Type of Date Column. If this Date column is coming from different table so check the valid relationship exist between them.
Or Try out different DAX formula to achieve the same result.
PREV YEAR COUNT= CALCULATE(COUNT('RequestList'[Reference]),DATEADD('RequestList'[RequestDate],-1,YEAR))
@rogerdea , Please use date table in all such cases.
Refer thsese examples and blog
YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31"))
Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))
This year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR('Date'[Date]),"12/31"))
Last year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year)),"12/31"))
Last to last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-2,Year),"12/31"))
Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))
Power BI — Year on Year with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.
User | Count |
---|---|
141 | |
113 | |
104 | |
78 | |
64 |
User | Count |
---|---|
136 | |
125 | |
107 | |
70 | |
61 |