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

Display only the first date for status changes only but not as a measure

I have a measure which works perfectly as a measure.
However, I would like to filter by date using my slicer and unfortunately slicers can't use measures.
Is there any way for me to achieve the same outcome but being able to add to my slicer filter?

This is the measure that I have which works fine:

Measure x =
VAR __m = CALCULATE ( MIN ( 'Test Scripts'[Changed Date]),
ALLEXCEPT ( 'Test Scripts', 'Test Scripts'[Work Item Id], 'Test Scripts'[State] ) )
RETURN IF ( MAX ( 'Test Scripts'[Changed Date] ) == __m, __m )

-----------------------------------------------------------------------------------------------

The measure ignores when the TAG changes (or anything else changes), except for Status ("State") changes and then only gets the FIRST DATE when the Status was changed.

-------------------------------------------------------------------------------------------------------

pbi_example_table.PNG


Thank you in advance for your help

2 ACCEPTED SOLUTIONS

@Anonymoususe this:

 

 

FirstChange =
CALCULATE (
    MIN ( 'Test Scripts'[Changed Date] ),
    FILTER (
        ALL ( 'Test Scripts' ),
        [ID] = EARLIER ( [ID] )
            && [Status] = EARLIER ( 'Test Scripts'[Status] )
    )
)




Feel free to connect with me:
LinkedIn

View solution in original post

v-eachen-msft
Community Support
Community Support

Hi @Anonymous ,

 

You could use "Group By" feature to get the minimum date in the query editor.

Here is the result.

3-1.PNG

Here is my test file for your reference.

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

6 REPLIES 6
v-eachen-msft
Community Support
Community Support

Hi @Anonymous ,

 

You could use "Group By" feature to get the minimum date in the query editor.

Here is the result.

3-1.PNG

Here is my test file for your reference.

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.
amitchandak
Super User
Super User

@Anonymous , with description input and the expected output, is not clear.

 

Can you share sample data and sample output in table format?

Anonymous
Not applicable

@amitchandak Sure. Find the sample tables below.

BEFORE

IDTAGTeamStatusChanged Date
007GoodTeam ANew01/06/2020
007BadTeam BNew02/06/2020
007NeutralTeam BClosed02/06/2020
007BadTeam BClosed03/06/2020


AFTER

IDTAGTeamStatusChanged Date
007GoodTeam ANew01/06/2020
007NeutralTeam BClosed02/06/2020

 

 

@Anonymoususe this:

 

 

FirstChange =
CALCULATE (
    MIN ( 'Test Scripts'[Changed Date] ),
    FILTER (
        ALL ( 'Test Scripts' ),
        [ID] = EARLIER ( [ID] )
            && [Status] = EARLIER ( 'Test Scripts'[Status] )
    )
)




Feel free to connect with me:
LinkedIn

@Anonymous , Us This in place of change date in after

LASTNONBLANKVALUE(Table[Changed Date], Min(Table[Status]))

AllisonKennedy
Super User
Super User

Measures update based on slicer selection, columns don't. Looks like you don't have any measures or slicers affecting this measure, so you could try doing this as a calculated column using EARLIER instead of variable. You'll need to probably use RANKX as well and will then need to filter out the later changes so you only have the date for the earliest change.

Is there a reason you can't use a DimDate table and relate that to Changed Date to achieve the same results?

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

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