Dear communities,
I am new to PBI desktop and I have problem generating a visual to compare categories with same period (months) with different years.
From my example below, I would like to show Axis X with Shop categories (A,B,C) and Axis Y are the total sales comparing same months from different years (2019 and 2020).
Attached the table of data for your reference. Any help are well appreciated.
ShopType | Order Date | Sales |
A | 1/1/2019 | 300 |
A | 1/12/2020 | 200 |
A | 2/12/2020 | 100 |
A | 2/12/2019 | 120 |
A | 3/12/2020 | 230 |
A | 3/12/2019 | 110 |
B | 1/28/2019 | 200 |
B | 1/6/2020 | 150 |
B | 2/2/2019 | 200 |
B | 2/6/2020 | 500 |
B | 3/3/2019 | 120 |
B | 3/6/2020 | 230 |
C | 5/28/2019 | 100 |
C | 5/13/2020 | 400 |
C | 6/28/2019 | 110 |
C | 6/13/2020 | 330 |
C | 7/28/2019 | 400 |
C | 7/13/2020 | 200 |
Thank you very much in advance.
Solved! Go to Solution.
@kerbaumalas , You can use time intelligence
Example
This Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR('Date'[Date]),"12/31"))
Last YTD complete Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year)),"12/31"))
Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))
This Year = CALCULATE(sum('order'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])))
Last Year = CALCULATE(sum('order'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])-1))
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/
See if my webinar on Time Intelligence can help: https://community.powerbi.com/t5/Webinars-and-Video-Gallery/PowerBI-Time-Intelligence-Calendar-WTD-Y...
Appreciate your Kudos.
@kerbaumalas , You can use time intelligence
Example
This Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR('Date'[Date]),"12/31"))
Last YTD complete Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year)),"12/31"))
Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))
This Year = CALCULATE(sum('order'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])))
Last Year = CALCULATE(sum('order'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])-1))
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/
See if my webinar on Time Intelligence can help: https://community.powerbi.com/t5/Webinars-and-Video-Gallery/PowerBI-Time-Intelligence-Calendar-WTD-Y...
Appreciate your Kudos.
Thank you very much @amitchandak your time intelligence resolve the Year comparison and I am able to pull a bar chart comparing shoptype by 2 different years.
However, when I want to zoom into Month by Months comparison, it don work anymore. Do you have any clue?
thank you very much.
Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.