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 don't know if I'll be able to explain all the details of the data, but I'll try my best. Sorry in advance.
The problem is this:
The matrix has 4 levels. In the fourth level, percentage is not calculating correctly.
The four levels are from different tables:
"Categorias" is Ordenação[Ordenação DRE Gerencial]
"Agrupador Nível ll" is ÍNDICE NÍVEL 2[Agrupador Nivel ll]
"Descrição" is Categorias[Descrição]
"Nome Fantansia" is "Cliente/Fornecedor/Transportadora"[Nome Fantansia]
The relationships
This is the percentage measure:
RB%2 = divide([realizado_correto_categoria],'@Medidas'[Medida KPIS],0)
This is the measures mentioned:
Measure 1:
realizado_correto_categoria =
VAR vArsubtotal = SELECTEDVALUE('ORDENAÇÃO'[Calculado])
RETURN
SWITCH(
TRUE(),
vArsubtotal = 0, [Realizado_categorias],
vArsubtotal <> 0 && NOT(ISINSCOPE('INDICE NÍVEL 2'[Agrupador Nível II])), [Realizado_categorias],
BLANK()
)Medida KPIS = CALCULATE([Realizado_categorias], Filter(ALL(DE_PARA_CTB),(DE_PARA_CTB[Código Nível II]= "1.1")))Realizado_categorias = var Subtotal = SELECTEDVALUE('ORDENAÇÃO'[Calculado])
var ordemContexto = Max('ORDENAÇÃO'[Índice])
var ValorSubtotalresumo =
CALCULATE(SUM(Movimentos_unificado[VALOR_USAR]),Filter(ALLNOBLANKROW('ORDENAÇÃO'), 'ORDENAÇÃO'[Índice] <= ordemContexto))
Return
SWITCH(
True(),
Subtotal = 0, SUM(Movimentos_unificado[VALOR_USAR]),
Subtotal = 1 && NOT(ISINSCOPE('INDICE NÍVEL 2'[Agrupador Nível II])), ValorSubtotalresumo,
BLANK()
)
The next:
Realizado_categorias = var Subtotal = SELECTEDVALUE('ORDENAÇÃO'[Calculado])
var ordemContexto = Max('ORDENAÇÃO'[Índice])
var ValorSubtotalresumo =
CALCULATE(SUM(Movimentos_unificado[VALOR_USAR]),Filter(ALLNOBLANKROW('ORDENAÇÃO'), 'ORDENAÇÃO'[Índice] <= ordemContexto))
Return
SWITCH(
True(),
Subtotal = 0, SUM(Movimentos_unificado[VALOR_USAR]),
Subtotal = 1 && NOT(ISINSCOPE('INDICE NÍVEL 2'[Agrupador Nível II])), ValorSubtotalresumo,
BLANK()
)
Measure 2:
Medida KPIS = CALCULATE([Realizado_categorias], Filter(ALL(DE_PARA_CTB),(DE_PARA_CTB[Código Nível II]= "1.1")))
If it's anything confusing, I can try to explain in more detail. I tried to screenshot the data model, but it looks a mess.
Thanks in advance!
Hi @Amanda_Araujo ,
I think you can check the relationships between tables, ensure that the context and filters are applied correctly. If you can provide more details with your desired output and pbix file without privacy information (or some sample data).
How to Get Your Question Answered Quickly
Best Regards
Yilong Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
User | Count |
---|---|
15 | |
8 | |
6 | |
6 | |
5 |
User | Count |
---|---|
25 | |
13 | |
12 | |
8 | |
8 |