Forum Discussion
DAX measure (Max/Min)
DAX measures for Max and Min
I am looking for the best way to calculate a measure that will compare sales from multiple year in a given Calendar Week and returning the max value. The measure should return the max by Calendar Week based on total sales (eg. sum of countries). I would need the same kind of measure for Min. Any suggestions?
| Table: Data | |||||
| Country | Product | Year | Calendar Week | Sales | |
| A | C | 2015 | 1 | 100 | |
| A | C | 2015 | 2 | 200 | |
| A | C | 2016 | 1 | 150 | |
| A | C | 2016 | 2 | 125 | |
| B | C | 2015 | 1 | 200 | |
| B | C | 2015 | 2 | 250 | |
| B | C | 2016 | 1 | 100 | |
| B | C | 2016 | 2 | 150 | |
| Calendar Week | Year | Total Sales | |||
| 1 | 2015 | 300 | |||
| 1 | 2016 | 250 | |||
| 2 | 2015 | 450 | |||
| 2 | 2016 | 275 | |||
| Output | |||||
| Measure should return: | |||||
| Calendar Week | |||||
| 1 | 300 | ||||
| 2 | 450 | ||||
Yes, it's works. Thanks a lot. Much more simple than I expected. Thanks.
8 Replies
- Lygral63
Helper I
Thanks, but I don't think that works. I need a measure that looks at total sales by Year and by Calendar Week and then returns the max or min value. It could be that in Calendar Week 1 has the max value based on sales in 2016, but Calendar 2 has the max value based on sales in 2015. Hope it makes sense.
- Lygral63
Helper I
I appreciate the effort, but I can't the the result I am expecting. The problem is that I have multiple years and need to max value from Calendar Week 1 (across all years), then the max from Calendar Week 2 (across all years) etc. So in total the measure should return the max value for every Calendar Week comparing data from all years. I hope that makes it a bit more clear.