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
oliharford
Regular Visitor

Calculate a value with a dividor depending on a true/false column

Hi,

 

I am hoping someone can help!

 

I have some order data where I need to calculate a profit however depending on payment method this varies. I essentially have a field that I need to get the correct calculation for which is the CostToUser.

 

This is what I currently have and is essentially what I am trying to do but as a novice I am not sure I know how to get this to actually work: 

TrueCostToUser = SUMX(FactCinemaSocietyOrderItems, IF('FactCinemaSocietyOrderItems'[IsCardPayment]=TRUE(), CALCULATE(SUM('FactCinemaSocietyOrderItems'[CostToUser])), CALCULATE(DIVIDE('FactCinemaSocietyOrderItems'[CostToUser],'FactCinemaSocietyOrderItems'[ExchangeRate]))))
 
In my head the logic is as simple as:
IF IsCardPayment = True 
  then
    CostToUser
  Else
    CostToUser/ExchangeRate
End If
 
I hope this is enough information for someone to help.
1 ACCEPTED SOLUTION
oliharford
Regular Visitor

I am not sure why i was overcomplicating it or what went wrong with my original attempts but I have resolved this with a simple new column:

TrueCostToUser = if('FactCinemaSocietyOrderItems'[IsCardPayment]=TRUE(),FactCinemaSocietyOrderItems[CostToUser],DIVIDE(FactCinemaSocietyOrderItems[CostToUser],'FactCinemaSocietyOrderItems'[ExchangeRate]))

View solution in original post

1 REPLY 1
oliharford
Regular Visitor

I am not sure why i was overcomplicating it or what went wrong with my original attempts but I have resolved this with a simple new column:

TrueCostToUser = if('FactCinemaSocietyOrderItems'[IsCardPayment]=TRUE(),FactCinemaSocietyOrderItems[CostToUser],DIVIDE(FactCinemaSocietyOrderItems[CostToUser],'FactCinemaSocietyOrderItems'[ExchangeRate]))

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.