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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

create measure using two tables and if condition

Hi,

 

I have two tables similar like below :

 

Table1

Person CountryID Salary

Sachin Ind        100

Dhoni  Ind         200

Messi   Arg        300

Nadal   Sp         400

 

Table2

CountryName CountryId

India                Ind

Argentina        Arg

Spain               Sp

 

Table1 have M:1 relationship with Table2

 

I want to create Measure using condition Measure=IF(Table2.CountryName="India",Table1.Salary,9999)

I can create this using calculated column but want to create Measure as Table1 is huge.

 

Thanks

1 ACCEPTED SOLUTION
Anonymous
Not applicable

[India Salary] =
IF( SELECTEDVALUE( Table2[CountryName] ) = "India",
    SUM( Table1[Salary] ),
    9999
)

View solution in original post

7 REPLIES 7
Anonymous
Not applicable

[India Salary] =
IF( SELECTEDVALUE( Table2[CountryName] ) = "India",
    SUM( Table1[Salary] ),
    9999
)
amitchandak
Super User
Super User

@Anonymous ,

Measure=IF(MAX(Table2[CountryName])="India",Sum(Table1[Salary]),9999)

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
Fowmy
Super User
Super User

@Anonymous 

Please explain a bit more on what exactly you need to calculate. Do you want to get the total salary of all the players if you select India or the maximum, minimum ?

________________________

Did I answer your question? Mark this post as a solution, this will help others!.

Click on the Thumbs-Up icon on the right if you like this reply 🙂

YouTube, LinkedIn 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Anonymous
Not applicable

I want to calculate total salary of India.


@Anonymous 

Try:

Measure = CALCULATE( SUM(Table1.Salary),Table2.CountryName="India")


________________________

Did I answer your question? Mark this post as a solution, this will help others!.

Click on the Thumbs-Up icon on the right if you like this reply 🙂

YouTube, LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Greg_Deckler
Community Champion
Community Champion

@Anonymous - 

Measure=IF(MAX(Table2[CountryName])="India",MAX(Table1[Salary]),9999)


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

Sorry but why you used MAX?

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.