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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
v-vpabbu
Community Support
Community Support

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

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
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.