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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Vanditha
Microsoft Employee
Microsoft Employee

Urgent !!! Query to Get latest status/value Using Dax/Power query

Hi  Every one . I need help on beow requirement.

Package rev needs to be sorted out in  desc. I did this. However main requirement is need to get the latest status based on the PackageRev column.

 

I have tried 

=
CALCULATE (
    MAX ( Merge1[PackageRev] ),
    FILTER (
        Merge1,
        Merge1[Application version id] = EARLIER ( Merge1[Application version id] )
    )
)
)

 

Measure2 = CALCULATE(
    VALUES(Merge1[Status]),
    ALLEXCEPT(Merge1, Merge1[Application version id]),
    FILTER(
        Merge1,
        'Merge1'[PackageRev] = CALCULATE(MAX(Merge1[Packagerev]), ALLEXCEPT(Merge1, 'Merge1'[Application version id])
    )
))
Column 2 = CALCULATE(MAX(Merge1[SortedColumn_new]), ALLEXCEPT(Merge1, Merge1[Application version id]))

 

but these queries not giving exact results.
Original data

Vanditha_1-1701084910714.png

Expected data

Vanditha_2-1701084958830.png

 

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

Hi @Vanditha ,

 

Based on your description, I obtained the following results using the sample you provided:

vtianyichmsft_0-1701150993328.png

Latest Rev = var _t1= ADDCOLUMNS('Table',"Test",MAXX(FILTER(ALL('Table'),[ID]=EARLIER([ID])),[PackageRev]))
var _t2 = ADDCOLUMNS(_t1,"True",IF([Test]=[PackageRev],1,0))
return CALCULATE(MAXX(FILTER(_t2,[True]=1),[PackageRev]))

 

An attachment for your reference. Hope it helps!

 

Best regards,
Community Support Team_ Scott Chang

 

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
Vanditha
Microsoft Employee
Microsoft Employee

Thanks for your support. I have achieved this formula in other way by creating group by with Key column. Thanks for your help and support.

v-tianyich-msft
Community Support
Community Support

Hi @Vanditha ,

 

Based on your description, I obtained the following results using the sample you provided:

vtianyichmsft_0-1701150993328.png

Latest Rev = var _t1= ADDCOLUMNS('Table',"Test",MAXX(FILTER(ALL('Table'),[ID]=EARLIER([ID])),[PackageRev]))
var _t2 = ADDCOLUMNS(_t1,"True",IF([Test]=[PackageRev],1,0))
return CALCULATE(MAXX(FILTER(_t2,[True]=1),[PackageRev]))

 

An attachment for your reference. Hope it helps!

 

Best regards,
Community Support Team_ Scott Chang

 

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

 

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! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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