Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
rpiboy_1
Helper V
Helper V

Understanding the differences between two time-intelligence expressions relative to Visual

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:

rpiboy_1_0-1743105799217.png

 

6 REPLIES 6
Anonymous
Not applicable

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

Anonymous
Not applicable

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

Anonymous
Not applicable

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

Deku
Super User
Super User

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])

)


Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

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


Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.