Reply
Sarvagya
Regular Visitor
Partially syndicated - Outbound

Dax code should only show the latest value in the chart

I want to write a Dax code, which give us the value for the latest data. I have written code, which is giving the latest value for all the three categories, but I only want to see the value for only the latest date i.e. 30th November data (Success = 9400)

 

I have tried different versions as well...

 

Yesterday order = calculate(sum('order summary item data'[total]), 'order summary item data'[date] = max('order summary item data'[date])))

 

IScreenshot 2022-12-13 185723.png

1 ACCEPTED SOLUTION
avatar user
Anonymous
Not applicable

Syndicated - Outbound

Hi @Sarvagya ,

Because you do not provide sample data, I create a table for test by my understand

1. below is my test table

vbinbinyumsft_0-1671089579796.png

2. create a measure with below dax formula

 

Measure =
VAR max_date =
    MAXX ( ALL ( 'Table' ), [Date] )
VAR cur_date =
    SELECTEDVALUE ( 'Table'[Date] )
RETURN
    IF ( cur_date = max_date, 1, 0 )

 

3. add a table visual and column visual  with fields

vbinbinyumsft_0-1671089887171.png

4. add the measure that created befor  to above visual filter pane

vbinbinyumsft_1-1671089981699.png

vbinbinyumsft_2-1671090006564.png

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
avatar user
Anonymous
Not applicable

Syndicated - Outbound

Hi @Sarvagya ,

Because you do not provide sample data, I create a table for test by my understand

1. below is my test table

vbinbinyumsft_0-1671089579796.png

2. create a measure with below dax formula

 

Measure =
VAR max_date =
    MAXX ( ALL ( 'Table' ), [Date] )
VAR cur_date =
    SELECTEDVALUE ( 'Table'[Date] )
RETURN
    IF ( cur_date = max_date, 1, 0 )

 

3. add a table visual and column visual  with fields

vbinbinyumsft_0-1671089887171.png

4. add the measure that created befor  to above visual filter pane

vbinbinyumsft_1-1671089981699.png

vbinbinyumsft_2-1671090006564.png

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

avatar user

Helpful resources

Announcements
March PBI video - carousel

Power BI Monthly Update - March 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors (Last Month)
Top Kudoed Authors (Last Month)