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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
abhiram342
Microsoft Employee
Microsoft Employee

DAX measure to get first value in selected group

Hi All,

I want to create dax measure for below scenario. Can some please help 

Table1:

IdTypeOfferValue
1R1A100
1R1C100
1R2C100
1R2A100

 

Table2:

IdName
1PBI

 

Table1 & Table2 are related based on Id.

 

Expected Results : For selected Column, I should perform group by operation and get First Value for that group

 

Expected Result1:

NameValue
PBI100

Expected Result2:

TypeNameValue
R1PBI100
R2PB1100

 

 

Thanks,

Abhiram

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@abhiram342 , Hope both tables are joined on ID

 

Use a measure like this for value

 

Measure =
VAR __id = MAX ('Table'[ID] )
VAR __date = CALCULATE ( Min('Table'[Offer] ), ALLSELECTED ('Table' ), 'Table'[ID] = __id )
return
CALCULATE ( sum ('Table'[Value] ), VALUES ('Table'[ID] ),'Table'[ID] = __id,'Table'[Offer] = __date )

 

 

All columns are from table1 here . Use ID from Table 1 in visual

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

View solution in original post

@abhiram342 , refer if the attached file can help

 

 

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

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@abhiram342 , Hope both tables are joined on ID

 

Use a measure like this for value

 

Measure =
VAR __id = MAX ('Table'[ID] )
VAR __date = CALCULATE ( Min('Table'[Offer] ), ALLSELECTED ('Table' ), 'Table'[ID] = __id )
return
CALCULATE ( sum ('Table'[Value] ), VALUES ('Table'[ID] ),'Table'[ID] = __id,'Table'[Offer] = __date )

 

 

All columns are from table1 here . Use ID from Table 1 in visual

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

Thanks @amitchandak For each Id the value is same. Intially, I have designed model as below and was doing max for each selected column but it didn't worked.

Example:  For Offer A, I should get 300 . Please let me know If I need to update the measure

 

Table2:

IdValue
1100
2200

Table1:

IdTypeOffer
1R1A
1R1C
1R2C
1R2A
2R3A

@abhiram342 , refer if the attached file can help

 

 

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

thank you @amitchandak!

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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