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 need your help on below.
I have two tables, a date table and fact table.
I'd like to implement a simple (custom) YTD logic to sum up YTD sales.
See below formula.
The formula is giving me the right results, but then when I try for example to drag in the calendar date to see details by date, the table remains blank.
What am I doing wrong?
I hope you can help.
Best,
P.
Solved! Go to Solution.
Hi,
thanks for your reply.
It almost worked. In the end the following code did the trick. I added another ALLSELECTED and then it worked. I cannot explain exactly why, but am happy 🙂
Best,
P
YTD =
CALCULATE (
SELECTEDMEASURE (),
ALLSELECTED ( Calendar_day ),
FILTER (
Calendar_day,
AND (
Calendar_day[Calendar_day.Commercial Year]
= CALCULATE (
MAX ( Calendar_day[Calendar_day.Commercial Year] ),
FILTER (
ALL ( Calendar_day ),
Calendar_day[Calendar_day.Calendar Date] = TODAY ()
)
),
Calendar_day[Calendar_day.Commercial Year_Week]
<= CALCULATE (
MAX ( Calendar_day[Calendar_day.Commercial Year_Week] ),
FILTER (
ALL ( Calendar_day ),
Calendar_day[Calendar_day.Calendar Date] = TODAY ()
)
)
)
)
)
Hi @PhMeDie ,
We can try to use the following measure to meet your requirement:
Sales YTD =
CALCULATE (
SUM ( 'Table'[Sales Quantity] ),
FILTER (
Calendar_day,
AND (
Calendar_day[Calendar_day.Commercial Year]
= CALCULATE (
MAX ( Calendar_day[Calendar_day.Commercial Year] ),
FILTER (
ALLSELECTED ( Calendar_day ),
Calendar_day[Calendar_day.Calendar Date] = TODAY ()
)
),
Calendar_day[Calendar_day.Commercial Year_Week]
<= CALCULATE (
MAX ( Calendar_day[Calendar_day.Commercial Year_Week] ),
FILTER (
ALLSELECTED ( Calendar_day ),
Calendar_day[Calendar_day.Calendar Date] = TODAY ()
)
)
)
)
)
If it doesn't meet your requirement, kindly share your sample data and expected result to me if you don't have any Confidential Information. Please upload your files to One Drive and share the link here.
Best regards,
Hi,
thanks for your reply.
It almost worked. In the end the following code did the trick. I added another ALLSELECTED and then it worked. I cannot explain exactly why, but am happy 🙂
Best,
P
YTD =
CALCULATE (
SELECTEDMEASURE (),
ALLSELECTED ( Calendar_day ),
FILTER (
Calendar_day,
AND (
Calendar_day[Calendar_day.Commercial Year]
= CALCULATE (
MAX ( Calendar_day[Calendar_day.Commercial Year] ),
FILTER (
ALL ( Calendar_day ),
Calendar_day[Calendar_day.Calendar Date] = TODAY ()
)
),
Calendar_day[Calendar_day.Commercial Year_Week]
<= CALCULATE (
MAX ( Calendar_day[Calendar_day.Commercial Year_Week] ),
FILTER (
ALL ( Calendar_day ),
Calendar_day[Calendar_day.Calendar Date] = TODAY ()
)
)
)
)
)
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 |
---|---|
113 | |
97 | |
85 | |
70 | |
61 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |