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

Shape the future of the Fabric Community! Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions. Take survey.

Reply
PowerRon
Post Patron
Post Patron

How to get right percentages in line chart with legend?

Hi,

I have this line chart showing the legend by numbers. Works fine

Knipsel1.JPGKnipsel2.JPG

 

 

 

 

 

But now I want it to show percentages instead of numbers. So what is the percentage of each legend-item each month?
I tried this

waarde =

VAR _waarde1 = [Number of Transactions]

VAR _waarde2 = CALCULATE([Number of Transactions], ALLSELECTED('Transactions Clearing Issuing'[Network Type Code]))

RETURN DIVIDE(_waarde1,_waarde2)

 

giving me this

 

Knipsel3.JPG

 

And I  tried this

 

waarde =

VAR _waarde1 = [Number of Transactions]

VAR _waarde2 = CALCULATE([Number of Transactions], ALLEXCEPT('Calendar Local Date', 'Calendar Local Date'[Year], 'Calendar Local Date'[Month Short ENG Name]))

RETURN DIVIDE(_waarde1,_waarde2)

 

giving me this

Knipsel4.JPG

 

In both solutions each month each lengend-item is 100%. What am I doing wrong?

Regards
Ron

 

 

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @PowerRon ,

 

You need to do the calculation based on the full network type and not on the months try something similar to this:

 

waarde =

VAR _waarde1 = [Number of Transactions]

VAR _waarde2 = CALCULATE([Number of Transactions], REMOVEFILTERS(Table[Network Type Code]))

RETURN DIVIDE(_waarde1,_waarde2)

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

4 REPLIES 4
PowerRon
Post Patron
Post Patron

Hmm, now it is fluctuating between 99 and 101%. So be it. It's OK. Thnx for helping Felix

PowerRon
Post Patron
Post Patron

@MFelix you solved it. Thnx. 

One more question. I only select the three network types, mentioned in the legend, in the visual. 
Each month tehy sum up between 98 and 99,5%. Never 100%. Any idea what is the cause?

Because you look for all the networks and not only the 3 you select redo the metric to this one:

 

waarde =

VAR _waarde1 = [Number of Transactions]

VAR _waarde2 = CALCULATE([Number of Transactions], ALLSELECTED(Table[Network Type Code]))

RETURN DIVIDE(_waarde1,_waarde2)

Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



MFelix
Super User
Super User

Hi @PowerRon ,

 

You need to do the calculation based on the full network type and not on the months try something similar to this:

 

waarde =

VAR _waarde1 = [Number of Transactions]

VAR _waarde2 = CALCULATE([Number of Transactions], REMOVEFILTERS(Table[Network Type Code]))

RETURN DIVIDE(_waarde1,_waarde2)

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.