Reputation: 31
I have a Power BI dataset with the following tables, all tables after Invoice details have a one to many relationship with the invoice table.
Tables: Invoice details, customer, date, product, and sales company.
In my visualization I have a table with the set up pictured below:
There are multiple product IDs for each invoice number.
How can I create a DAX measure that says, if the Sales Org ID is "IDH", divide price by 0.5, all else to be divided by 0.7?
My current formula is this:
_Calculated Units =
if(SELECTEDVALUE('Sales Company'[Sales Org ID]) = "IDH", sum('INVOICE DETAILS'[Price]) / 0.5, sum('INVOICE DETAILS'[Price]) / 0.7)
But this results in an error when I add it to the visualization. I don't want to create a calculated column, any ideas on how to create this measure?
Upvotes: 0
Views: 5360
Reputation: 31
I figured it out. Switched to a dataset with less data and didn't receive an error.
if(SELECTEDVALUE('Sales Company'[Sales Org ID]) = "IDH", sum('INVOICE DETAILS'[Price]) / 0.5, if(SELECTEDVALUE('Sales Company'[Sales Org ID]) = "GAD",sum('INVOICE DETAILS'[Price]) / 0.7))
Upvotes: 0