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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
gadlakha
Frequent Visitor

DAX Query

Hi All,

I have a table that lists the Release_IDs, Release_Versions, Release_Category, Release_BaseVersion and a flag to specify if a given release was external or not.

IDVersionCategoryBaseisRelease
616XYZ.1.7.1master1.7False
616XYZ.1.7.1master1.7False
648XYZ.1.7.5master1.7False
654XYZ.1.7.6master1.7True
655XYZ.1.7.7master1.7False
763XYZ.1.7.34master1.7False
1423XYZ.1.9.0.2master1.9.0False
1427XYZ.1.9.0.3master1.9.0True
1460XYZ.1.9.0.12master1.9.0False
1463XYZ.1.9.0.13master1.9.0False
876XYZ.1.7.59master1.7False
1003XYZ.1.8.0.9master1.8.0False
1004XYZ.1.7.0.5r1.7.01.7.0False
1005XYZ.1.7.0.5r1.7.01.7.0True
1007XYZ.1.7.82master1.7.0False
1169XYZ.1.8.0.32master1.8.0False
1466XYZ.1.9.0.12master1.9.0True
1468XYZ.1.9.0.14master1.9.0False
1593XYZ.1.9.0.45master1.9.0False
1598XYZ.1.9.0.46master1.9.0True
1603XYZ.1.9.0.47master1.9.0False
1171XYZ.1.7.0.32r1.7.01.7.0False
1162XYZ.1.8.0.29master1.8.0True

 

What I want is to add a new column that would state the last release build version based on Release_Category and Release_BaseVersion. A given Release_Category and Release_BaseVersion could have multiple external releases and thus all subsequent Release_ID should point to the last available release build version for a given category.

Any help would be greatly appreciated.

 

Regards.

6 REPLIES 6
gadlakha
Frequent Visitor

Hey. Can someone kindly help with this?

Anonymous
Not applicable

Hi @gadlakha ,

 

Plese try this:

LastRelId = 
CALCULATE (
    MAX ( 'Table'[ID] ),
    FILTER (
        ALL ( 'Table' ),
        'Table'[isRelease] = TRUE ()
            && 'Table'[Category] = EARLIER ( 'Table'[Category] )
            && 'Table'[Base] = EARLIER ( 'Table'[Base] )
            && 'Table'[Index] <= EARLIER ( 'Table'[Index] )
    )
)

vcgaomsft_0-1672214696677.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

Greg_Deckler
Community Champion
Community Champion

@gadlakha Try:

Category = 
  VAR __Category = [Category]
  VAR __Base = [Base]
  VAR __Max = MAXX(FILTER(ALL('Table'),[Category] = __Category && [Base] = __Base),[ID])
  VAR __Result = MAXX(FILTER(ALL('Table'),[ID] = __ID),[Version])
RETURN
  __Result


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Hi, Thanks for the reply. I did tried it out but the data is not as expected. Below is what I get when I add a new column based on your reply:

gadlakha_0-1669864200773.png

As you could see, this is not right. For the very first row, the last available release for category: master and base: 1.7 is with ID: 654. Thus, any row with category: master, base: 1.7 and ID less than 654 should not have an entry.

The right expected data set would be as below:

gadlakha_1-1669864464043.png

 

amitchandak
Super User
Super User

@gadlakha , not very clear.

 

a new column

= if(maxx(filter(Table, [Category] = earlier([category]) && [version] = earlier([version]) ), [ID]) =[ID] 1,0)

 

Power BI DAX- Earlier, I should have known Earlier: https://youtu.be/CVW6YwvHHi8

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

Hey, Thanks for your reply.

I did tried the solution but the result is not as expected. Below is what I get as a new column with your proposed solution:

gadlakha_2-1669864690448.png

I am confused what a 1 or 0 denotes here.

The expected outcome would be as below:

gadlakha_3-1669864746122.png

Appreciate if you could help.

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.

Top Solution Authors