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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
amelief
Frequent Visitor

Percent, Legend and Histogram

Hi Everyone,

 

I'm trying to make a histogram with a year-by-year comparison of answers 1 to 5.
it gives me this :

1.JPG

 

My question is about the total : I don't kown how to have 100% by year (legend).

My problem is that the total per year is not 100%. It's the sum of all my bars that is 100%.

2.JPG

 

May you help me ? 

 

Thanks a lot !

2 ACCEPTED SOLUTIONS
Stachu
Community Champion
Community Champion

I don;t think it;s possible with just UI, you will need to:
1) create a new measure (press 'New Measure' in Modelling in the ribbon)
2) syntax should be something like this - you will need to adjust the blue parts

this code assumes that Annee is a numeric field, not text

 

% of total =
VAR varYear =
    MAX ( Table[Annee] )
RETURN
    DIVIDE (
        SUM ( Table[Nombre de Quel...] ),
        CALCULATE ( SUM ( Table[Nombre de Quel...] ), Table[Annee] = varYear )
    )

 



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

View solution in original post

v-chuncz-msft
Community Support
Community Support

@amelief,

 

You may use measure below.

Measure =
DIVIDE (
    SUM ( Table1[value] ),
    CALCULATE ( SUM ( Table1[value] ), ALLSELECTED ( Table1[answer] ) )
)
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
v-chuncz-msft
Community Support
Community Support

@amelief,

 

You may use measure below.

Measure =
DIVIDE (
    SUM ( Table1[value] ),
    CALCULATE ( SUM ( Table1[value] ), ALLSELECTED ( Table1[answer] ) )
)
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you ! Sorry, I did'nt saw your answer before ! 

Stachu
Community Champion
Community Champion

I don;t think it;s possible with just UI, you will need to:
1) create a new measure (press 'New Measure' in Modelling in the ribbon)
2) syntax should be something like this - you will need to adjust the blue parts

this code assumes that Annee is a numeric field, not text

 

% of total =
VAR varYear =
    MAX ( Table[Annee] )
RETURN
    DIVIDE (
        SUM ( Table[Nombre de Quel...] ),
        CALCULATE ( SUM ( Table[Nombre de Quel...] ), Table[Annee] = varYear )
    )

 



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

Stachu
Community Champion
Community Champion

what's the syntax for the [%TG...] measure?



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

I only put this params : 

3.JPG

 

Do you have an idea ?

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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