Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hi
I'm trying to create a sales report that shows current sales in one column and the previous years figures for the same period. I'm using the following DAX
Solved! Go to Solution.
Create a date table join with your date and then try any one of these
Total Sales PY = CALCULATE(SUM('Live Company$G_L Entry'[PositiveAmount]), SAMEPERIODLASTYEAR('Date'[Date]))
YTD Sales = CALCULATE(SUM('Live Company$G_L Entry'[PositiveAmount]),DATESYTD(('Date'[Date]),"12/31"))
Last YTD Sales = CALCULATE(SUM('Live Company$G_L Entry'[PositiveAmount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))
Last YTD complete Sales = CALCULATE('Live Company$G_L Entry'[PositiveAmount]),DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year)),"12/31"))
Last to last YTD Sales = CALCULATE(SUM('Live Company$G_L Entry'[PositiveAmount]),DATESYTD(dateadd('Date'[Date],-2,Year),"12/31"))
Year behind Sales = CALCULATE(SUM('Live Company$G_L Entry'[PositiveAmount]),dateadd('Date'[Date],-1,Year))
2 Year behind Sales = CALCULATE(SUM('Live Company$G_L Entry'[PositiveAmount]),dateadd('Date'[Date],-2,Year))
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
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/
Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution.
In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blogs -Decoding Direct Query - Time Intelligence, Winner Coloring on MAP, HR Analytics, Power BI Working with Non-Standard TimeAnd Comparing Data Across Date Ranges
Connect on Linkedin
Create a date table join with your date and then try any one of these
Total Sales PY = CALCULATE(SUM('Live Company$G_L Entry'[PositiveAmount]), SAMEPERIODLASTYEAR('Date'[Date]))
YTD Sales = CALCULATE(SUM('Live Company$G_L Entry'[PositiveAmount]),DATESYTD(('Date'[Date]),"12/31"))
Last YTD Sales = CALCULATE(SUM('Live Company$G_L Entry'[PositiveAmount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))
Last YTD complete Sales = CALCULATE('Live Company$G_L Entry'[PositiveAmount]),DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year)),"12/31"))
Last to last YTD Sales = CALCULATE(SUM('Live Company$G_L Entry'[PositiveAmount]),DATESYTD(dateadd('Date'[Date],-2,Year),"12/31"))
Year behind Sales = CALCULATE(SUM('Live Company$G_L Entry'[PositiveAmount]),dateadd('Date'[Date],-1,Year))
2 Year behind Sales = CALCULATE(SUM('Live Company$G_L Entry'[PositiveAmount]),dateadd('Date'[Date],-2,Year))
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
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/
Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution.
In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blogs -Decoding Direct Query - Time Intelligence, Winner Coloring on MAP, HR Analytics, Power BI Working with Non-Standard TimeAnd Comparing Data Across Date Ranges
Connect on Linkedin
User | Count |
---|---|
102 | |
91 | |
87 | |
79 | |
71 |
User | Count |
---|---|
113 | |
105 | |
101 | |
75 | |
64 |