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
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
Europe Fabric Conference

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.

Top Solution Authors