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
Anonymous
Not applicable

modify my measure using if

Im looking for a measure formula

I have a data table. In this table I have a column called account type (text).

In this ‘table’ I also create a measure (number).

 

What I would like to have: if the account type column=rev my measure need to multiple by -1, otherwise I need to show my original measure value.

 

In excel it’s a simple IF AND , however in PowerBI looks like to me for if and I can only use my measures as a variable, not the columns that already exist? Am I right?

 

When I tried to create if and formula I have the following error.a single vales for column accont type in table cannot be determined.

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Try like

new Measure =
calculate(-1*[measure],[account type] = "rev")+ calculate([measure],[account type] <> "rev")

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Anonymous , Try like

new Measure =
calculate(-1*[measure],[account type] = "rev")+ calculate([measure],[account type] <> "rev")

Anonymous
Not applicable

hi all

thank you @az38 I am not an expert in powerBI but when I tried to copy your technique, I had an error.
thank you@amitchandak, I also try this solutions and its worked

THank you 4 everybody!

az38
Community Champion
Community Champion

Hi @Anonymous 

try this technique

Measure = 
var _type = MAX(Table[account type])
var _measure = --YOURMEASURESTATEMENT--
RETURN
IF(_type = "rev", -1 * _measure , _measure )

 


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

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.