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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
AnaR
Helper I
Helper I

IF Statement plus Multiplication using static number

Hi all!

 

Sorry if it's a silly one (because I feel like it should be a pretty straight forward one), but can I have help with the below please.

 

I'm trying to replicate the formulae below in Power BI:

=IF(Y2="Y",(AL2*0.25),0)

 

Where:

Y2 =  would be the column in Power BI with the criteria I want to meet

AL2 = the second column I want to multiply the value by the Gift Aid rate

0.25 = 25% of Gift Aid rate (static number, not a column)

 

Basically, I need to meet a condition in a column so I can multiply the second one based on a static rate number.

 

Is it because the number I need to multiply by is not a column instead?

 

Thanks,

Ana

1 ACCEPTED SOLUTION
AnaR
Helper I
Helper I

I found the answer here -> https://www.enjoysharepoint.com/power-bi-measure-multiply/ (Power BI Measure multiply by 100).

 

_GA Income Calcs = IF(SELECTEDVALUE('Single Donations'[GiftAid]) = "Yes", CALCULATE(SELECTEDVALUE('Single Donations'[amount]) * 0.25, FILTER('Single Donations', 'Single Donations'[GiftAid] = "Yes")), 0)
 
AnaR_0-1684748053938.png

 

Thank you so much for all your help with this, @pratyashasamal .

View solution in original post

19 REPLIES 19
LukeFPowerBI
New Member

I am trying to use the basic element of this and struggling its not accepting the argument for me

GA Income Calcs = IF(SELECTEDVALUE('vw_Transactions'[GiftAidStatus]) = "TRUE", CALCULATE(SELECTEDVALUE('vw_Transactions'[DiscountedValue]) * 0.25, FILTER('vw_Transactions','vw_Transactions'[GiftAidStatus]) = "TRUE")),0)


i get this
The syntax for ',' is incorrect. (DAX(IF(SELECTEDVALUE('vw_Transactions'[GiftAidStatus]) = "TRUE", CALCULATE(SELECTEDVALUE(vw_Transactions[DiscountedValue]) * 0.25, FILTER(vw_Transactions,vw_Transactions[GiftAidStatus]) = "TRUE")),0))).

 

I honestly cant see what i am doing wrong because based on the info on this post and aligning to my own data this should work?  I am new to powerbi only been a user for a few weeks.

 

I am new t

AnaR
Helper I
Helper I

I found the answer here -> https://www.enjoysharepoint.com/power-bi-measure-multiply/ (Power BI Measure multiply by 100).

 

_GA Income Calcs = IF(SELECTEDVALUE('Single Donations'[GiftAid]) = "Yes", CALCULATE(SELECTEDVALUE('Single Donations'[amount]) * 0.25, FILTER('Single Donations', 'Single Donations'[GiftAid] = "Yes")), 0)
 
AnaR_0-1684748053938.png

 

Thank you so much for all your help with this, @pratyashasamal .

Hi @LukeFPowerBI , please check my response to my own post here - I found a solution on that link I shared in my response. There is also the calculation I used.

 

From what I rmember, that worked fine.

 

Thanks,

Ana

Hi I also tried this 

I also tried the second tip 

Gift Aid Income = IF('vw_Transactions'[IsGiftAided]"TRUE",CALCULATE(SUM('vw_Transactions'[DiscountedValue])*0.25),0)
For some reason the first past the IF('vw_Transactions'[IsGiftAided]= "TRUE" seems to only want to pick up measures that are created and not table data.
pratyashasamal
Memorable Member
Memorable Member

Hi @AnaR ,
Try this calculation ,

 

Measure = IF(SUM('Table'[Y2])= "Y",CALCULATE(SUM('Table'[AL2])*0.25)),0)

if you want to have 0.25 or 25 % in column you can do that just you need to aggregate and then multiple .
For example :-
Where gift = 25 %
Measure = IF(SUM('Table'[Y2])= "Y",CALCULATE(SUM('Table'[AL2])*(SUM('Table'[Gift])/100)),0)

 

Thanks ,
Pratyasha Samal
Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Can you help I have copied your answer but getting errors

I am trying to use the basic element of this and struggling its not accepting the argument for me

GA Income Calcs = IF(SELECTEDVALUE('vw_Transactions'[GiftAidStatus]) = "TRUE"CALCULATE(SELECTEDVALUE('vw_Transactions'[DiscountedValue]) * 0.25FILTER('vw_Transactions','vw_Transactions'[GiftAidStatus]) = "TRUE")),0)


i get this
The syntax for ',' is incorrect. (DAX(IF(SELECTEDVALUE('vw_Transactions'[GiftAidStatus]) = "TRUE", CALCULATE(SELECTEDVALUE(vw_Transactions[DiscountedValue]) * 0.25, FILTER(vw_Transactions,vw_Transactions[GiftAidStatus]) = "TRUE")),0))).

 

I honestly cant see what i am doing wrong because based on the info on this post and aligning to my own data this should work?  I am new to powerbi only been a user for a few weeks.

I also tried the second tip 

Gift Aid Income = IF('vw_Transactions'[IsGiftAided]= "TRUE",CALCULATE(SUM('vw_Transactions'[DiscountedValue])*0.25),0)
For some reason the first past the IF('vw_Transactions'[IsGiftAided]= "TRUE" seems to only want to pick up measures that are created and not table data.

Thansk for that. Just tried but it's saying it's incorrect:

AnaR_0-1684403778658.png

Thanks,

Ana

Measure = IF('Table'[Y2]= "Y",CALCULATE(SUM('Table'[AL2])*0.25),0)

Try this





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Didn't work again:

AnaR_0-1684404855161.png

I'll probably create an extra column for the 25%.

No need what is data type of GiftAid column ?

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Try this once,
This will work only from the Y2 column (GiftAid) column datatype is text and it also has a value of Yes in it . Exact function will match the Y2 column with Yes text and return a True / false column .

 

Measure = IF(Exact('Table'[Y2],"Yes"),CALCULATE(SUM('Table'[AL2])*0.25),0)

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Sorry, also didn't work. After the "Exact", it doesn't allow me to chose a table.

 

GiftAid column is Text

Amount column is Decimal number.

Measure = IF('Table'[Y2] == "Yes",CALCULATE(SUM('Table'[AL2])*0.25),0)




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Again, it doesn't allow me to select a table, only the other measures I have.

 

Would any screen shot help? Not sure of what to be honest hehe I think the issue is the aggregation after the IF, isn't it?

This is ss , 
Measure 3 is where is am checking if the condition is Yes or not .
Then multiplying it with my sales value .
and Measure 2 is a simple measure with "Yes" or "No" values.
pratyashasamal_0-1684407062936.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Below is an example of my data:

AnaR_0-1684407511062.png

This is what I get when trying your latest statement:

AnaR_1-1684407620993.png

 

Even if I type the table/column, still it doesn't work. Both columns ("GiftAid" and "amount") used for the calculation are from the same table. But I don't think it should matter, should it?

Please check once what is the datatype of GiftAid column and change it to text if it not a text .

pratyashasamal_0-1684408594606.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





It is a Text. And it's not a measure, it's a column.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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