The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
I have month wise Depatrment wise Consumption. Now i want to take Average of Previos 3 month consumption.
In case consumption of current month is more than average of previous 3 months, then i want red sign next to the current month value in my table and in case it is less than the average of previous 3 months, then i want green sign next to the current month value.
Sample table below
Hi @ddhingra
You can try the following format measure, 1 is green and 0 is red
Formatting Measure =
VAR CurrentConsumption = [Consumption]
VAR Average3MonthsConsumption =
AVERAGEX (
TOPN (
3,
SUMMARIZE (
ALLSELECTED ( 'Table' ),
'Date'[YearMonth],
"@Consumption", CALCULATE ( [Consumption], ALL ( 'Date'[MonthName] ) )
),
'Date'[YearMonth], ASC
),
[@Consumption]
)
RETURN
INT ( Average3MonthsConsumption > CurrentConsumption )
User | Count |
---|---|
26 | |
10 | |
8 | |
6 | |
5 |
User | Count |
---|---|
33 | |
13 | |
12 | |
9 | |
7 |