Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

convert this pbi exp

Hi all,

 

i want this to be converted to pbi exp.   how to create this  as measure.

 

if(Data_Source='GORA',sum(Number_Of_Seats),count(Number_Of_Seats))
  • Hi Anonymous 

     

    We rarely judge the table name in IF function in power bi, but if you'd like to calculate based on the table name, you can create a new table which lists all the table names, and write something like this:

    Assuming there're A,B,C 3 tables. we'd like to calculate when we select B:

    if(selectedvalue(Tablelist(column))="B",sum('B'(Number_Of_Seats)),count('B'(Number_Of_Seats)))

     

    You can find more reference here about converting SQL to DAX:

    https://www.sqlbi.com/articles/from-sql-to-dax-projection/ 

     

1 Reply

  • v-diye-msft's avatar
    v-diye-msft
    Icon for Community Support rankCommunity Support

    Hi Anonymous 

     

    We rarely judge the table name in IF function in power bi, but if you'd like to calculate based on the table name, you can create a new table which lists all the table names, and write something like this:

    Assuming there're A,B,C 3 tables. we'd like to calculate when we select B:

    if(selectedvalue(Tablelist(column))="B",sum('B'(Number_Of_Seats)),count('B'(Number_Of_Seats)))

     

    You can find more reference here about converting SQL to DAX:

    https://www.sqlbi.com/articles/from-sql-to-dax-projection/