Hey Everyone,
This is something that is relatively easy for me to figure out in other BI tools but I've had some issues with Power BI and DAX. Here is a sample table "Sales" :
Store Number | Adjustment | Sales |
1 | a | 4 |
1 | b | 2 |
1 | c | 6 |
2 | a | 4 |
2 | b | 8 |
2 | c | 7 |
What I want to do is show total Sales value and an Adjusted Sales value based on an Adjustment Rule.
The Adjustment Rule is as follows:
IF Adjustment =a then 100% of sales
IF Adjustment=b then 90% of sales
IF Adjustment=c then 50% of sales
So I want to have a table that has the total sales and adjusted sales:
Store Number | Sales | Adjusted Sales |
1 | 12 | 8.8 |
2 | 19 | 14.7 |
(i'm pretty sure I got the math right)
I started off with a dax statement in a calculated column that is something like:
IF(Adjustment="a", SUM(Sales),
IF(Adjustment="b", SUM(Sales)*0.9,
IF(Adjustment="c", SUM(Sales)*0.5,0
)))
But when it populated in Power BI it doesn't make sense at the row level. I think it was duplicating the values over all the rows so when I went to sum up all the adjusted sales it was exponentially more than the sales--- which according to the calculation it should be the same or less than the sales. I think I need a measure but I noticed that I can't have string columns in measure statments. How can I do this in DAX?
Thanks in advance,
Matt