Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hello friends!
I have a pbix file with an example of a database. In it I have the categories in rows (3 levels) and the years and months in columns. As if it were an income statement.
Please help me with a vertical and horizontal analysis of the data in percentages.
I'm attaching the files and an image.
Thank you very much for your help.
file.rar (.pbix and .xlsx)
https://drive.google.com/file/d/1C7wTH7rzKXbOg5BrsGdd0J6kxyXuZwr-/view?usp=sharing
file .pbix
https://drive.google.com/file/d/1YNwDlwJtpuk3WRuFoQd4G2l_fIvEs2Ov/view?usp=sharing
file .xlsx
Solved! Go to Solution.
You sorted dDRE[Nivel 1] column with dDRE[Ordem], so if you want to remove filters on [Nivel 1] you need to remove filters on both [Nivel 1] and [Ordem] column.
If I understand your expected results correctly then this is how you need to modify your measure
% Valor Orig Parc (n1n2c) V2 (PBI Community) =
Var __Numerator = [Valor Orig Parc]
Var __Denominator =
SWITCH(
TRUE(),
ISINSCOPE(dDRE[Categoria 1]), CALCULATE([Valor Orig Parc],ALLSELECTED(dDRE[Categoria 1], dDRE[Nível 2], dDRE[Nível 1], dDRE[Ordem] ) ),
ISINSCOPE(dDRE[Nível 2]), CALCULATE([Valor Orig Parc],ALLSELECTED( dDRE[Nível 2], dDRE[Nível 1], dDRE[Ordem] ) ),
ISINSCOPE(dDRE[Nível 1]), CALCULATE([Valor Orig Parc],ALLSELECTED( dDRE[Nível 1], dDRE[Ordem] ) ),
CALCULATE([Valor Orig Parc],ALLSELECTED(dDRE[Categoria 1], dDRE[Nível 2], dDRE[Nível 1], dDRE[Ordem] ) )
)
RETURN DIVIDE(__Numerator, __Denominator)
This would be the result. My named the measure as [AV2] in the below matrix.
Please be informed I used [Valor Orig Parc] measure in the denominator if you want to use [Valor Orig Parc Geral] then you can replace it in the demoinator variable. I am attaching the PBIX for your reference.
Need a Power BI Consultation? Hire me on Upwork
Connect on LinkedIn
|
You sorted dDRE[Nivel 1] column with dDRE[Ordem], so if you want to remove filters on [Nivel 1] you need to remove filters on both [Nivel 1] and [Ordem] column.
If I understand your expected results correctly then this is how you need to modify your measure
% Valor Orig Parc (n1n2c) V2 (PBI Community) =
Var __Numerator = [Valor Orig Parc]
Var __Denominator =
SWITCH(
TRUE(),
ISINSCOPE(dDRE[Categoria 1]), CALCULATE([Valor Orig Parc],ALLSELECTED(dDRE[Categoria 1], dDRE[Nível 2], dDRE[Nível 1], dDRE[Ordem] ) ),
ISINSCOPE(dDRE[Nível 2]), CALCULATE([Valor Orig Parc],ALLSELECTED( dDRE[Nível 2], dDRE[Nível 1], dDRE[Ordem] ) ),
ISINSCOPE(dDRE[Nível 1]), CALCULATE([Valor Orig Parc],ALLSELECTED( dDRE[Nível 1], dDRE[Ordem] ) ),
CALCULATE([Valor Orig Parc],ALLSELECTED(dDRE[Categoria 1], dDRE[Nível 2], dDRE[Nível 1], dDRE[Ordem] ) )
)
RETURN DIVIDE(__Numerator, __Denominator)
This would be the result. My named the measure as [AV2] in the below matrix.
Please be informed I used [Valor Orig Parc] measure in the denominator if you want to use [Valor Orig Parc Geral] then you can replace it in the demoinator variable. I am attaching the PBIX for your reference.
Need a Power BI Consultation? Hire me on Upwork
Connect on LinkedIn
|
Good morning!
Could we do a horizontal percentage analysis of a given month in relation to the previous month?
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
14 | |
10 | |
10 | |
10 | |
9 |
User | Count |
---|---|
20 | |
13 | |
12 | |
11 | |
8 |