Forum Discussion
KPI visual not showing correct results when using the Quarter column
- 2 years ago
Quarter uses static and pre-defined 3 month chunks IE Jan-Mar, Apr-Jun etc.
If you want dynamic calculations based on last 90 days and 180 to 90 days ago relative to today, there are several different things you might do depending on what exactly you're trying to achieve.-You could calculate them separately using measures and filtering on the [date].
Last_90_Days = CALCULATE(COALESCE(SUM([VALUE), 0), [DATE] >= TODAY() - 90)
180_to_90_Days_Ago = CALCULATE(COALESCE(SUM([VALUE), 0), [DATE] >= TODAY() - 180, [DATE] < TODAY() - 90)
-An alternative would be to add a calculated column to your date table that you could use as "Quarter". Maybe something like this....Custom_Quarter = CEILING(DIVIDE(TODAY() - [DATE] + 1, 90), 1)With this column, the last 90 days has value 1, the previous 90 days has value 2, etc etc.
-Or maybe this calculated column in your date table, if you'd prefer having it show up in your visual as text.
Custom_Quarter =var date_range = CEILING(DIVIDE(TODAY() - [DATE] + 1, 90), 1)returnSWITCH(date_range ,1, "Last 90 days",2, "180 to 91 days ago",3, "270 to 181 days ago","Long time ago")Totally depends on what, exactly, you're trying to do here. Hopefully one of these ideas proves useful to you.
///Mediocre Power BI advice, but it's free///
Quarter uses static and pre-defined 3 month chunks IE Jan-Mar, Apr-Jun etc.
If you want dynamic calculations based on last 90 days and 180 to 90 days ago relative to today, there are several different things you might do depending on what exactly you're trying to achieve.
-You could calculate them separately using measures and filtering on the [date].
Last_90_Days = CALCULATE(COALESCE(SUM([VALUE), 0), [DATE] >= TODAY() - 90)
180_to_90_Days_Ago = CALCULATE(COALESCE(SUM([VALUE), 0), [DATE] >= TODAY() - 180, [DATE] < TODAY() - 90)
-An alternative would be to add a calculated column to your date table that you could use as "Quarter". Maybe something like this....
-Or maybe this calculated column in your date table, if you'd prefer having it show up in your visual as text.
///Mediocre Power BI advice, but it's free///