Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

measure with subtotal per year in a visual

Hello all,

 

you will find below a sample data

 

IdYearStats
12021Oui
22021Oui
32021Oui
42021Non
52021Non
62021Oui
72021Oui
82020Oui
92020Oui
102020Oui
112020Non

 

i want to use that data to create the visual below, that shows the camparaison of stats between the year 2021 & the year 2020.

My problem in that visual is that the subtotal per year is not 100%, but the pourcentage is calculated in the basis of the two years!

 

Pratically, i want to see that in the year 2020 we had 75% of "Oui" and 25% of "Non" , and in the year 2021 i had 62,5% of "Oui" and 37,5% of "Non".

The result i'm getting from my measure is not what i really need :

Akontra_0-1642117779244.png

Here is the Measure created for this sample data : 

Mesure = CALCULATE(COUNT(Feuil1[Année]))        And i show it as a % in the visual

 

Can you help me ?

Thankfully,

A.K

2 ACCEPTED SOLUTIONS
VahidDM
Super User
Super User

Hi @Anonymous 

 

Try this measure:

Measure = 
Var _A = COUNTROWS('Table')
Var _B = CALCULATE(COUNTROWS('Table'),ALLEXCEPT('Table','Table'[Year]))
return
_A/_B

 

output:

VahidDM_0-1642119046331.png

 

 

 

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

View solution in original post

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

2 REPLIES 2
VahidDM
Super User
Super User

Hi @Anonymous 

 

Try this measure:

Measure = 
Var _A = COUNTROWS('Table')
Var _B = CALCULATE(COUNTROWS('Table'),ALLEXCEPT('Table','Table'[Year]))
return
_A/_B

 

output:

VahidDM_0-1642119046331.png

 

 

 

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.