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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
user919
Regular Visitor

Latest Result Based on Date Slicer Selection

Below outlines an example of what we are trying to accomplish with the DAX calculation.


For the purposes of this example, I have listed one manager, four different Transaction Dates, 2 Feature IDs, and Attorney Rep Count (the metric we are trying to roll-up). For Attorney Rep Count, Attorney Rep represents a “Yes” or “No” response and can only be a 1 or a 0.

 

Mngr  Trns_Date   Feature_IDs  Atty_Rep_Cnt
ABC    1/1/2022       1234                   0
ABC    1/2/2022       5678                   1
ABC    3/15/2022     1234                   1
ABC    3/16/2022     5678                   1

 

My goal is to display the latest metric for the time period selected for each Feature ID and then roll it up at a categorical level (in this example, manager represents the categorical level). As displayed above, each Feature Key could be have several rows of data with multiple transaction dates.

 

For this example, if the end user selects 1/1/2022 through today in the slicer, Atty_Rep_Cnt for Manager “ABC” it should equal 2, not 3. 

1 ACCEPTED SOLUTION
v-yadongf-msft
Community Support
Community Support

Hi @user919 ,

 

Please try following DAX:

Latest Result = IF(
    'Table'[Trns_Date] = 
    MAXX(FILTER('Table','Table'[Feature_IDs] = EARLIER('Table'[Feature_IDs])),
    'Table'[Trns_Date]),
    'Table'[Atty_Rep_Cnt]
    )

vyadongfmsft_0-1663664210780.png

 

You will get result fort Atty_Rep_Cnt for Manager “ABC” is 2, not 3. 

vyadongfmsft_1-1663664250691.png

 

Best regards,

Yadong Fang

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

3 REPLIES 3
v-yadongf-msft
Community Support
Community Support

Hi @user919 ,

 

Has your problem been solved? If solved, please consider Accept it as the solution to help the other members find it more quickly.

 

Best regards,

Yadong Fang

v-yadongf-msft
Community Support
Community Support

Hi @user919 ,

 

Please try following DAX:

Latest Result = IF(
    'Table'[Trns_Date] = 
    MAXX(FILTER('Table','Table'[Feature_IDs] = EARLIER('Table'[Feature_IDs])),
    'Table'[Trns_Date]),
    'Table'[Atty_Rep_Cnt]
    )

vyadongfmsft_0-1663664210780.png

 

You will get result fort Atty_Rep_Cnt for Manager “ABC” is 2, not 3. 

vyadongfmsft_1-1663664250691.png

 

Best regards,

Yadong Fang

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

@user919 , Try like

 

Last Qty = Var _max = maxx(filter( ALLSELECTED(Data1), Data1[Mngr] = max(Data1[Mngr]) && [Feature_IDs]= max(Data1[Feature_IDs]) ),Data1[Trns_Date])
return
CALCULATE(sum(Data1[Atty_Rep_Cnt]), filter( (Data1), Data1[Mngr] = max(Data1[Mngr]) && [Feature_IDs]= max(Data1[Feature_IDs]) && Data1[Trns_Date] =_max))


Sum Last Qty = sumx(Summarize(Data1,Data1[Mngr],data1[Feature_IDs] ) , [Last Qty])

 

refer

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

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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