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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Sarvagya
Regular Visitor

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
Anonymous
Not applicable

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
Anonymous
Not applicable

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

@Sarvagya , refer if my blogs can help

https://amitchandak.medium.com/power-bi-get-the-last-latest-value-of-a-category-d0cf2fcf92d0

https://amitchandak.medium.com/power-bi-get-the-sum-of-the-last-latest-value-of-a-category-f1c839ee8...

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.