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,
I'd appreciate your help on a DAX measure.
We are on a 4-4-5 calendar. I have a date table in which I have a column with the calendar date. Furthermore I have an additional column which indicates the comparable date one year ago. Because of our calendar logic I cannot use the SAMEPERIOD function because the dates are not necessarily shifted always by 365 days.
Fact table is linked to the calendar date column.
Can anyone help me to rewrite the SAMEPERIOD function so it also works in our retail calendar logic?
Thanks for your help.
Best,
Phil
Solved! Go to Solution.
Hi,
in the end the following formula did the trick.
Previous Year Revenue =
CALCULATE (
[Net Sales VAT excluded EUR],
FILTER (all(Calendar_day),Calendar_day[Commercial Date_Next Year ] in values(Calendar_day[Calendar Date])))
This approach requires that in the calendart able a second column is maintained containing the comparable date of last year.
Thanks anyways for your help.
Best,
Philipp
Hello,
and thanks for your answer.
It would resolve my problem partially. What if a user does not select continous dates, but maybe the 3 sundays in December and would like to compare them with the comparable sundays of the previous year? Then that formula wouldn't give me the right results.
My intution is trying to tell me that it must be possible by somehow filtering the previous date column on all the dates which are in the current context. But I cannot figure out how to do it.
Hi @PhMeDie ,
what you want to do is possible. You mentioned that 'I have a date table in which I have a column with the calendar date. Furthermore, I have an additional column which indicates the comparable date one year ago.'
When a user selects something in Power BI (for example via a slicer), he is filtering the full rows not just some cells. This means that when the user selects the 3 Sundays in December he is filtering 3 rows. And these rows have the column 'which indicates the comparable date one year ago' . We can use this column to find the amount for the previous year.
Could you share a Power BI file? (using One Drive or another similar tool)
Based on your current file, I can recommend how to best do that
LC
Hi,
in the end the following formula did the trick.
Previous Year Revenue =
CALCULATE (
[Net Sales VAT excluded EUR],
FILTER (all(Calendar_day),Calendar_day[Commercial Date_Next Year ] in values(Calendar_day[Calendar Date])))
This approach requires that in the calendart able a second column is maintained containing the comparable date of last year.
Thanks anyways for your help.
Best,
Philipp
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 |
---|---|
112 | |
97 | |
85 | |
67 | |
59 |
User | Count |
---|---|
150 | |
120 | |
100 | |
87 | |
68 |