Forum Discussion
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
- Anonymous6 years ago
[India Salary] = IF( SELECTEDVALUE( Table2[CountryName] ) = "India", SUM( Table1[Salary] ), 9999 )
7 Replies
- Greg_Deckler
Community Champion
Anonymous -
Measure=IF(MAX(Table2[CountryName])="India",MAX(Table1[Salary]),9999)- AnonymousNot applicable
Sorry but why you used MAX?
- Fowmy
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 🙂
- AnonymousNot applicable
I want to calculate total salary of India.
- Fowmy
Super User
- amitchandak
Super User
Anonymous ,
Measure=IF(MAX(Table2[CountryName])="India",Sum(Table1[Salary]),9999)
- AnonymousNot applicable
[India Salary] = IF( SELECTEDVALUE( Table2[CountryName] ) = "India", SUM( Table1[Salary] ), 9999 )