Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi,
The below is the sample dataset on which i need to display on 2 visuals
1. last 7 days compariosn of current year sales with the previous year sales
2. Month on month comparison of sales for current year to previous year
Please suggest how to achieve this.
Thanks
@jitpbi
If you do not have a date table then you can use the followin as per your sample above:
Last 7 Days Sales =
CALCULATE(
SUM('Table'[Sales]),
FILTER(
ALL('Table'[Date]),
'Table'[Date] <= MAX('Table'[Date]) && 'Table'[Date] >= MAX('Table'[Date]) - 7
)
)
Last 7 Days LY Sales =
CALCULATE(
SUM('Table'[Sales]),
FILTER(
ALL('Table'[Date]),
var __date = EDATE(MAX('Table'[Date]),-12) return
'Table'[Date] <= __date && 'Table'[Date] >= __date - 7
)
)
________________________
If my answer was helpful, please click Accept it as the solution to help other members find it useful
Click on the Thumbs-Up icon if you like this reply 🙂
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
@Fowmy ,
Thank you for the suggestion. I tried your dax but this is not coming for only 7 days as it shows other day's data also:
thanks
@jitpbi
I can check how you have applied the formula if you could share a dummy PBIX file with the same setup
________________________
If my answer was helpful, please click Accept it as the solution to help other members find it useful
Click on the Thumbs-Up icon if you like this reply 🙂
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
https://www.dropbox.com/s/ajbxf6qjz8p0e5b/test_DOD.pbix?dl=0 Hi @Fowmy ,
I am sharing the dropbox link to download the pbix file.
Thanks
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
108 | |
105 | |
88 | |
74 | |
66 |
User | Count |
---|---|
126 | |
111 | |
100 | |
83 | |
71 |