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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
Scubadiver007
Regular Visitor

Retain original percentage on filtering

Hi all,

If I filter this table for "yes", the percentages revert back to 100%. What would I need to do keep the original percentage.

 

Scubadiver007_0-1738681433927.png

 

Following on from this, how could I compare boys and girls (or other groups) but in the same table. Below, the first table is for boys and the second is for girls.

 

Scubadiver007_1-1738681883006.png

I would like to put this information into a clustered bar chart or line chart.

 

I am a total newbie at this!

 

David

1 ACCEPTED SOLUTION

Hi @Scubadiver007 

 

Try changing your code to this:

 

GLD_Perc = DIVIDE([GLD], [Total_Pupils], 0)

 

DIVIDE function (DAX) - DAX | Microsoft Learn

 

Regards,

Nono Chen

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

8 REPLIES 8
Scubadiver007
Regular Visitor

Hi, thanks for the replies but i've been having a rethink now I have learnt a bit more about how it works.😊

 

I have three measures

 

Total_Pupils = count(EYFS[DfE])
GLD = countrows(filter(EYFS,EYFS[GLD]="Yes"))
GLD_Perc = divide([GLD]/[Total_Pupils],0)
 
I have these measures in a table but the percentage isn't showing. Any idea why?
 
Scubadiver007_0-1739441007913.png

 

Hi @Scubadiver007 

 

Try changing your code to this:

 

GLD_Perc = DIVIDE([GLD], [Total_Pupils], 0)

 

DIVIDE function (DAX) - DAX | Microsoft Learn

 

Regards,

Nono Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Scubadiver007
Regular Visitor

Hi,

Apologies, I wasn't clear enough. I should have said it is pupil level data so either has a "yes" or "no" recorded. The 'sex' comes from the census table and the GLD comes from the EYFS table (1-to-1 relationship). The census year can come from either table.

 

So can you go back one step and explain how you would create your dummy table?

 

Thanks

 

 

 

 

 

Hi @Scubadiver007 

 

Please provide sample data that fully covers your issue and the expected outcome based on the sample data you provided.

 

Regards,

Nono Chen

v-nuoc-msft
Community Support
Community Support

Hi @Scubadiver007 

 

Thank you very much parry2k for your prompt reply.

 

Is your problem solved? If not, here are some suggestions:

 

Here's some dummy data

 

“Table”

vnuocmsft_0-1738911280579.png

 

The first problem: creating a measure.

 

Total % = 
VAR totalValues = 
CALCULATE(
    SUM('Table'[Values]),
    FILTER(
        ALL('Table'),
        'Table'[Year] = MAX('Table'[Year])
    )
)
VAR totalGLD = 
CALCULATE(
    SUM('Table'[Values]),
    FILTER(
        'Table',
        'Table'[Year] = MAX('Table'[Year]) 
        &&
       'Table'[GLD] = MAX('Table'[GLD])
    )
)
RETURN
DIVIDE(totalGLD, totalValues)

 

Create a matrix.

vnuocmsft_1-1738911387560.png

 

vnuocmsft_2-1738911446101.png

 

The second question: Create a Measure.

 

Total SEX % = 
VAR totalValues = 
CALCULATE(
    SUM('Table'[Values]),
    FILTER(
        ALL('Table'),
        'Table'[Year] = MAX('Table'[Year])
        &&
       'Table'[SEX] = MAX('Table'[SEX])
    )
)
VAR totalGLD = 
CALCULATE(
    SUM('Table'[Values]),
    FILTER(
        'Table',
        'Table'[Year] = MAX('Table'[Year]) 
        &&
       'Table'[GLD] = MAX('Table'[GLD])
       
    )
)
RETURN
DIVIDE(totalGLD, totalValues)

 

Create a Line chart.

vnuocmsft_3-1738911601706.png

 

vnuocmsft_4-1738911694492.png

You can get:

 

vnuocmsft_5-1738911727861.png

 

If you're still having problems, provide some dummy data and the desired outcome. It is best presented in the form of a table.

 

Regards,

Nono Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

parry2k
Super User
Super User

@Scubadiver007 np, share the calculation you are using on the visual that is showing %



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Scubadiver007
Regular Visitor

As I said, I am a total newbie. All I've done is create a matrix and I don't know what to do next.

parry2k
Super User
Super User

@Scubadiver007 you need to change your measure  to either add removefilters or ALL dax function. Share your measure expression for solution.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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

Top Solution Authors