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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
KH_Mike
Helper III
Helper III

How to use "If" in "New Measure" to check the another field?

Hello All,

 

I am trying to use the "New Measure" to hardcode the "Target" number. However, I am not sure how to check the data column in order to return the correct "Target".

 

My formula is like this but it won't work.  

If ( Data[Type] = "A" , 100 , If ( Data[Type] = "B" = 200 , If ( Data[Type] = "C" = 300 , 0 )))

3 REPLIES 3
KH_Mike
Helper III
Helper III

Hi All,

 

I try to use max on for each Data[Type] and it do return the result I want. However, why the "Total" is not the sum by all those figure? Now, the "Total" is 300 .......

@KH_Mike , Try one of the two ways.

 

Sumx(Data,
Switch ( True(),
Data[Type] = "A" , 100 ,
Data[Type] = "B" = 200 ,
Data[Type] = "C" = 300 , 0 ))

 

Sumx(Values(Max(Data[Type])), calculate(
Switch ( True(),
Max(Data[Type]) = "A" , 100 ,
Max(Data[Type])= "B" = 200 ,
Max(Data[Type])= "C" = 300 , 0 ) ) )

Hi @amitchandak 

 

I tried to use your method but it will come out few thousand for A and few thousand for B. Is it because I have many serval A and B records?

Helpful resources

Announcements
Fabcon_Europe_Social_Bogo

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.