DAX does not have QUARTER ()?
Yes this is correct.
Really?
Yes, that shit does not make any sense. Fortunately, a workaround is simply dividing the month by 3.
Decision:
VAR quarterNumber = CEILING(MONTH([Date])/3,1)
Alternative solutions:
Since DAX has several ways to round numbers, they will also work:
VAR quarterNumber = ISO.CEILING(MONTH([Date])/3,1) VAR quarterNumber = ROUNDUP(MONTH([Date])/3,0)
Which solution is best:
- For this calculation, the results will be identical.
- For calculations other than QUARTER, the result may be small and subtle differences depending on the standards or type of processor used.
- ROUNDUP is probably more intuitive for Excel people.
- CEILING is probably more intuitive to math.
- ISO.CEILING is ugly to look at the code, personal opinion.
source share