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
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
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!

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.