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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
SzymonKl
Helper I
Helper I

If , Else

Hi All

Please can you help me. I need to create a new calculated column called [BKPI] the table called(9amUpdate). The table contains  columns: [SiteID], [Volume], [Hours]. (Diferend SiteID diferent BKPI)

need to create base on calculation [SiteID] = 1 ,[BKPI] = 500 ,else [SiteID] = 2 ,[BKPI] = 550 ,and so on to SiteID 9. please note that BKPI values 500 and 550 are only examples .

 

1 ACCEPTED SOLUTION
Vijay_A_Verma
Super User
Super User

If you are using DAX, use below kind of formula

BKPI = SWITCH([SiteID], 1, 500, 2, 550, 3, 630, 4, 690, 5, 713, 6, 759, 7, 890, 8, 134, 9, 403,"")  

If you are PQ, use below kind of formula in a custom column named BKPI

= if [SiteID]=1 then 500
else if [SiteID]=2 then 550
else if [SiteID]=3 then 630
else if [SiteID]=4 then 690
else if [SiteID]=5 then 713
else if [SiteID]=6 then 759
else if [SiteID]=7 then 890
else if [SiteID]=8 then 134
else if [SiteID]=9 then 403
else null

 

 

View solution in original post

1 REPLY 1
Vijay_A_Verma
Super User
Super User

If you are using DAX, use below kind of formula

BKPI = SWITCH([SiteID], 1, 500, 2, 550, 3, 630, 4, 690, 5, 713, 6, 759, 7, 890, 8, 134, 9, 403,"")  

If you are PQ, use below kind of formula in a custom column named BKPI

= if [SiteID]=1 then 500
else if [SiteID]=2 then 550
else if [SiteID]=3 then 630
else if [SiteID]=4 then 690
else if [SiteID]=5 then 713
else if [SiteID]=6 then 759
else if [SiteID]=7 then 890
else if [SiteID]=8 then 134
else if [SiteID]=9 then 403
else null

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors