Forum Discussion
Selectedvalue in a Switch measure not selecting dates correctly
- 3 years ago
LewisB , Create a measure like
x-Updated Sales Measure = Sumx('# Sales' , SWITCH(
True(),
('# Sales'[Company Code]) = "pus" && ('# Sales'[Invoice Date]) >= DATE(2023,01,01) && ('# Sales'[Invoice Date]) <= DATE(2023,03,31), SUMX('# Sales', '# Sales'[Net Sales Amount] * 1.4997),
('# Sales'[Company Code]) = "pus" && ('# Sales'[Invoice Date]) >= DATE(2022,10,01) && ('# Sales'[Invoice Date]) <= DATE(2022,12,31), SUMX('# Sales', '# Sales'[Net Sales Amount] * 1.5302),
SUM('# Sales'[Net Sales Amount])
))
refer approach
Measure way
Power BI Dax Measure- Allocate data between Range: https://youtu.be/O653vwLTUzM
Thanks amitchandak - this seems to have done the trick. However, the overall totals seem to be coming out wrong (it seems the totals are duplicated x the number of lines in an invoice etc). I know this will have something to do with SUMX, as that calculates line by line. See screenshot below. I'll create a new thread for this and tag you in it