Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I'm working on some time intliegence analysis. So I reviewed the Italian's article on the subject.
Prior to reviewing their article I had managed to write my own expression for YTD. I then applied their approach and also intergrated the hidden T/F Measure into my existing Measure. Both measures work fine in a Matrix, yet when I put both measures in a Card, only my original measure returns a value, the measure based on the DAX Pattern returns blank.
Is this due to the fact that my measure defines an explict date context, whereas the Pattern based measure relies on an explicit date context from the visual? In which case the Matrix meets that requirement, whereas the Card does not?
My original measure:
Closed RT YTD =
VAR MaxDate = MAX('Date'[Date])
VAR MinDate = STARTOFYEAR('Date'[Date])
VAR _datesBetween = DATESBETWEEN('Date'[Date], MinDate, MaxDate)
VAR result =
IF(
[ShowValueForProjectDates],
CALCULATE(
[Closed],
_datesBetween,
ALL('Date')
)
)
RETURN
result
DAX Pattern Measure:
Closed YTD =
VAR _result =
IF(
[ShowValueForProjectDates],
CALCULATE(
[Closed],
DATESYTD( 'Date'[Date] )
)
)
RETURN
_result
Screen snip of cards vs matrix:
Hi @rpiboy_1
Thanks @Deku for Addressing the issue.
we would like to follow up to see if the solution provided by the super user resolved your issue. Please let us know if you need any further assistance.
If our super user response resolved your issue, please mark it as "Accept as solution" and click "Yes" if you found it helpful.
Regards,
Vinay Pabbu
Hi @rpiboy_1,
May I ask if you have gotten this issue resolved?
If it is solved, please mark the helpful reply or share your solution and accept it as solution, it will be helpful for other members of the community who have similar problems as yours to solve it faster.
Regards,
Vinay Pabbu
Hi @rpiboy_1,
May I ask if you have gotten this issue resolved?
If it is solved, please mark the helpful reply or share your solution and accept it as solution, it will be helpful for other members of the community who have similar problems as yours to solve it faster.
Regards,
Vinay Pabbu
It needs a date context. You can see the total is blank too.
You should be able to supply a context by wrapping your calculate in another one, simulating the outer filter context that you get in a visual
Calculate(
Your calculate
, treatas( {max(dates[date])}, date[date])
)
So my intution was correct, its the lack of date context supplied by the Card that causes the issue.
My understanding was that it is generally bad form to nest Calculates within Calculates?
My intution is that the biggest drawback to sticking with my original measure as compared to the DAX pattern based measure is likely performance, more than anything?
Nothing wrong with nesting calculate, won't affect performance.
The built in date intelligence functions are syntax sugar, you can achieve more versatililty and same performance with a custom one
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
20 | |
7 | |
6 | |
5 | |
5 |
User | Count |
---|---|
26 | |
10 | |
10 | |
9 | |
6 |