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

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.

Reply
Anonymous
Not applicable

Help on creating DAX formula

Hello everyone
I am a sort of a beginner in DAX so I can't figure out how to get the result I want. I have the model shown belowmodel.png

 

What I want to do is this:
1) Filter Snapshot Info to get the latest [Date Time]

2) Get [Value] of Time Profile where [Snapshot ID] = 'Snapshot Info'[Snapshot ID] && [Start Time Interval] = 'Snapshot Info'[Start Time] from the previous step

Nood question I know but I'm stuck

Thank you!

1 ACCEPTED SOLUTION

My bad.  Misread your post.  Please see if this one works.  If not, please explain more on how you are using this measure.

 

Value Measure =
VAR __latestdate =
    MAX ( 'Snapshot Info' )
RETURN
    CALCULATE (
        MAX ( 'Time Profile'[Value] ),
        'Time Profile'[Start Time Interval] = __latestdate
    )

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

6 REPLIES 6
mahoneypat
Employee
Employee

Please try this measure expression.  The relationship is already making sure the IDs match, but adding the TREATAS() can pass the value of Start Time to the Start Time Interval column too (if they match exactly).

 

 

Value Measure =
CALCULATE (
    MAX ( 'Time Profile'[Value] ),
    TREATAS (
        VALUES ( 'Snapshot Info'[Start Time] ),
        'Time Profile'[Start Time Interval]
    )
)

 

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Anonymous
Not applicable

Hi @mahoneypat 
It almost works. One thing left to do is get the latest Snapshot ID which I get by getting the latest 'Snapshot Info'[Date Time]. The measure is taking into account all Snapshots for now.

My bad.  Misread your post.  Please see if this one works.  If not, please explain more on how you are using this measure.

 

Value Measure =
VAR __latestdate =
    MAX ( 'Snapshot Info' )
RETURN
    CALCULATE (
        MAX ( 'Time Profile'[Value] ),
        'Time Profile'[Start Time Interval] = __latestdate
    )

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Anonymous
Not applicable

@mahoneypat 

Thank you that one worked!! Cheers!

lbendlin
Super User
Super User

Do you want that as a measure or as a calculated column?

Anonymous
Not applicable

Hi @lbendlin !
I want a measure

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors