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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Milan6687
Helper II
Helper II

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

@Milan6687 ,

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

Fowmy
Super User
Super User

@Milan6687 

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

I want to calculate total salary of India.


@Milan6687 

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

@Milan6687 - 

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

@ 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!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

Sorry but why you used MAX?

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors