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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Neilt
Regular Visitor

Help with percentages

Hi Community,

 

apologies if this seems like a noob question but in desperate need of help.

 

we have a Power BI dataset Already which tells me the records recorded over a monthly period, I even have a column in the dataset which tells me if that record has hit SLA or not, I have this value as simply HIT or MISS.

 

I have managed to work out using a table the percentage of hits vs the number of misses, drilled down over the last 6 month however cannot seem to work out how to not display the MISS data without it messing up the HIT data, can anyone offer any advice on what I am doing wrong?

 

also is there anyway for DAX to work out the percentage change month over month based on the HIT percentage?

 

many thanks in advance

3 REPLIES 3
tamerj1
Super User
Super User

Hi @Neilt 

This might not be so accurate as I have no idea about your data structure but you may try one of the following

1. You can have a slicer with "HIT", "MISS" and use the following code

Percentage =
VAR Numerator =
    COUNTROWS ( Table )
VAR Denominator =
    CALCULATE ( COUNTROWS ( Table ), ALLEXCEPT ( Table, Table[Date] ) )
VAR Result =
    DIVIDE ( Numerator, Denominator )
RETURN
    Result

The result percentage will be based on the slicer selection. If you select HIT it will give you the percentage of HIT's and same for MISS

2. code for HIT only

HIT Percentage =
VAR Numerator =
    CALCULATE ( COUNTROWS ( Table ), Table[Hit SLA?] = "HIT" )
VAR Denominator =
    CALCULATE ( COUNTROWS ( Table ), ALLEXCEPT ( Table, Table[Date] ) )
VAR Result =
    DIVIDE ( Numerator, Denominator )
RETURN
    Result

 

  

bcdobbs
Super User
Super User

Can you share a santised pbix file with some example data, your model and what you have so far.

 

It sounds like you probably just need to include a REMOVEFILTERS inside calculate to prevent the filter context interfering. Hard to be more specific at the moment though.



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

Hi Ben

 

Due to the confidental data in the pbix I cannot share unfortunetely 

 

I can however show you the table I am getting back at the moment

 

Neilt_0-1648359290679.png

Its pulling in the right amount of Miss and Hit data however if I use my filters to try remove the miss data my HIT data auto turns to 100% which is the issue, all I really want is the HIT data percentage displaying so 64.52 for this month 62.96 for last etc

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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