Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi,
I'm trying to make the table bellow in Power BI but I don't know how to make this conditional formatting...
Basically it compares the numbers between the years. If the result is higher than the previously it becomes green, if it is lower it becomes red
Thanks for any help
Solved! Go to Solution.
Hi @Pedro_Lourenco ,
A measure like this can give you the "status" per year. The "status" can than be used to control the conditional formatting.
It assumes that you have a data table like "name", "year", "result"
R1 =
var LastYear = if (HASONEVALUE(Results[Year]), VALUES('Results'[Year])-1)
var LastYearResult = CALCULATE( sum(Results[Result]), 'Results'[Year]=LastYear)
var CurrentYearResult = sum('Results'[Result])
return
if (LastYearResult<CurrentYearResult, 1,-1)
Regards,
Jan
(if this is a solution for you don't forget to mark it as a solution)
Hi @Pedro_Lourenco ,
We can set condiftion formatting based on the measure as below.
Measure =
VAR pre =
MAX ( 'Table'[Year] ) - 1
VAR va =
SUM ( 'Table'[value] )
VAR pres =
CALCULATE (
SUM ( 'Table'[value] ),
FILTER ( ALLEXCEPT ( 'Table', 'Table'[Name] ), 'Table'[Year] = pre )
)
RETURN
IF ( pres = BLANK (), BLANK (), IF ( pres > va, "red", "green" ) )
Pbix as attached.
Hi @Pedro_Lourenco ,
A measure like this can give you the "status" per year. The "status" can than be used to control the conditional formatting.
It assumes that you have a data table like "name", "year", "result"
R1 =
var LastYear = if (HASONEVALUE(Results[Year]), VALUES('Results'[Year])-1)
var LastYearResult = CALCULATE( sum(Results[Result]), 'Results'[Year]=LastYear)
var CurrentYearResult = sum('Results'[Result])
return
if (LastYearResult<CurrentYearResult, 1,-1)
Regards,
Jan
(if this is a solution for you don't forget to mark it as a solution)
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
113 | |
99 | |
80 | |
70 | |
59 |
User | Count |
---|---|
149 | |
114 | |
107 | |
89 | |
67 |