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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
Anonymous
Not applicable

DAX Query for Getting a filtered value

I need the DAX query to get the below measure or calculated column. How to achieve ?

 

Get StatusName from ActionTable WHERE Action_Date = MAX(Action_Date) and Status != 17

1 ACCEPTED SOLUTION
AlB
Community Champion
Community Champion

Hi @Anonymous 

Place this measure in a card visual:

GetStatusName =
VAR maxDate_ = MAX ( ActionTable[Action_Date] )
RETURN
    CALCULATE (
        DISTINCT ( ActionTable[StatusName] ),
        ActionTable[Action_Date] = maxDate_,
        ActionTable[Status] <> 17
    )

 

SU18_powerbi_badge

Please accept the solution when done and consider giving a thumbs up if posts are helpful. 

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

 

View solution in original post

2 REPLIES 2
AlB
Community Champion
Community Champion

Hi @Anonymous 

Place this measure in a card visual:

GetStatusName =
VAR maxDate_ = MAX ( ActionTable[Action_Date] )
RETURN
    CALCULATE (
        DISTINCT ( ActionTable[StatusName] ),
        ActionTable[Action_Date] = maxDate_,
        ActionTable[Status] <> 17
    )

 

SU18_powerbi_badge

Please accept the solution when done and consider giving a thumbs up if posts are helpful. 

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

 

Hey @Anonymous ,

please excuse, but I do not fully understand your requirement. As "Get StatusName ..." does not indicate if you are looking for a single value (a scalar value) or a table (a single-column table).

 

The solution @AlB provided might return an error, if more than one StatusName are satisfying the condition. CALCULATE(...) will return a scalar value, whereas DISTINCT() will return a table. There is an implicit datatype transformation happening as a single-column table with one row can be transformed into a scalar value if necessary, here this transformation is triggered by CALCULATE().

Maybe you can take some time and be more specific about the nature of your expected result, if the nature of your business prevents multiple StatusName for the same date and the status <> 17, then, excuse this post.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon & SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.

Users online (5,001)