Forum Discussion
Conditional formatting logic keeps reverting back to percent/number
- 1 year ago
Hi leolapa_br , look how its easy when we interact with a dashboard, what you need is just edit interactions between any visual including treemap to filter your column chart.
Select treemap visual, go to format, click on edit interactions and in your column chart choose filter as shown bellow:
When i click in treemap value to filter, its now showing correct values.
Hi leolapa_br ,
The behavior you're observing with the conditional formatting is expected, but let’s analyze both visuals together to better understand what’s happening.
In your second visual (the filtered one), you’ll notice that the conditional formatting remains consistent: the red areas stay red, and the green areas stay green as first visual (not filtered), regardless of whether the values are positive or negative.
What does this mean?
It indicates that the measure you're using for conditional formatting, "ticket médio ASA %," likely contains a function that is overriding the filters applied in the visual. For instance, you might be using the ALL function or another function that removes filters within your measure.
To fix this:
- Review your measure.
Check if functions like ALL, REMOVEFILTERS, or CALCULATE are used in a way that ignores your slicer or visual filters. - Adjust the measure logic.
Modify the measure so it respects the filters applied in the visual. For example, avoid ALL unless it’s absolutely necessary, or use KEEPFILTERS to ensure the slicer filters are honored.
If my theory isn’t correct, I recommend trying the solution provided by Jai-Rathinavel , as it could address the issue from another angle.
- leolapa_br1 year ago
Resolver II
I really apreciate your time on this one Bibiano_Geraldo.
It's funny that by the time you were writing your answer I was replying to Jai-Rathinavel's suggestion and mentioning the same finding you had, which is the one that concerns the fact that the formatting stays consistent across months whether or not a filter is applied.
And I agree that the use of ALL/REMOVEFILTERS, etc. on any of the measures that lead up to 'Ticket médio ASA %' might be the culprit on this one.
Below is a compilation of all measures that lead up to 'Ticket médio ASA %' being 'fVendas' the facts table containing all sales-related data and 'dCalendario' being the dates/calendar table:
Ticket médio ASA % = -- It divides... DIVIDE ( [Ticket médio ASA], -- ... the difference between this year's and last year's measure. [Ticket médio AA], -- ... by the prior year's measure. 0 ) Ticket médio ASA = VAR ValorPeriodoAtual = [Ticket médio] -- This year's measure. VAR ValorPeriodoAnterior = [Ticket médio AA] -- Last year's measure. VAR Resultado = IF ( NOT ISBLANK ( ValorPeriodoAtual ) && NOT ISBLANK ( ValorPeriodoAnterior ), ValorPeriodoAtual - ValorPeriodoAnterior ) RETURN Resultado Ticket médio AA = -- Last year's measure. IF ( [MostrarValorParaDatas], CALCULATE ( [Ticket médio], CALCULATETABLE ( DATEADD ( dCalendario[Data], -1, YEAR ), dCalendario[DataComTransações] = TRUE ) ) ) MostrarValorParaDatas = -- Check whether each respective date had sales. VAR UltimaDataComDados = CALCULATE ( MAXX ( { MAX ( 'fVendas'[Mês/Ano] ), MAX ( 'fVendas'[Data] ) }, [Value] ), REMOVEFILTERS () ) VAR PrimeiraDataVisivel = MIN ( 'dCalendario'[Data] ) VAR Resultado = PrimeiraDataVisivel <= UltimaDataComDados RETURN Resultado Ticket médio = -- It divides... DIVIDE( [Faturamento], -- ... this year's sales dollars. [Quantidade de vendas], -- ... by this year's sales volumes. 0 ) Quantidade de vendas = -- This year's sales volumes. VAR Tabela_Prov = SUMMARIZE( fVendas, fVendas[Mês/Ano], "NF Cont", DISTINCTCOUNTNOBLANK(fVendas[Nota Fiscal]) ) RETURN SUMX( Tabela_Prov, [Contagem de vendas] ) Contagem de vendas = DISTINCTCOUNTNOBLANK(fVendas[Nota Fiscal]) Faturamento = -- This year's sales dollars. SUMX( fVendas, (fVendas[Quantidade] * fVendas[Preço Unitário]) - fVendas[Desconto] + fVendas[Acréscimo] )The only measure that uses REMOVEFILTERS is [MostrarValorParaDatas] which is a hidden measure within the 'dCalendar' table used just to check whether each respective date had sales.
I actually removed that measure within [Ticket médio AA] by getting rid of the IF statement but the problem persisted, so it doesn't look like the problem resides there.
- Bibiano_Geraldo1 year ago
Super User
leolapa_br , The variação % vs ano anterior is the same with Ticket médio ASA % measure? if no, use variação % vs ano anterior measure as condition to your rules.
- leolapa_br1 year ago
Resolver II
Hi Bibiano_Geraldo, they're both the same thing, sorry for not mentioning it before. I had the measure renamed just to make it more readable for the end users.