cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
BruceSV
Frequent Visitor

Adjusting percentages based on filter

I have a measure that calculates the percentage of column_numbers based on a selection which works on the total data when using specific boolean type filter based on column_boolean. The measure is as follows:

 

 

 

percentage = (DIVIDE(SUM(data[column_numbers]),CALCULATE(SUM(data[column_numbers]),ALL(data))))*100

 

 

 

However, I also have a column_dates in my dataset. When I select a specific month I want it to display the percentage of that specific month, and not the included records as a percentage of a whole. 

 

Example of dataset:

column_datescolumn_numberscolumn_boolean
Jan1true
Jan2false
Feb3true
Feb4false

Mar

5true
Mar0false

 

Outcome examples:

selection 1: column_dates = all, column_boolean = true

expected outcome 1: 53% (calculation: 1 + 3 + 5 / 15)

 

selection 2: column_dates = Jan, column_boolean = true

expected outcome 2: 33% (1 / 3)

 

selection 3: column_dates = Jan & Mar, column_boolean = true

expected outcome 3: 75% (1 + 5 / 😎

 

With the current measure only selection 1 provides the correct result.

1 ACCEPTED SOLUTION
ryan_mayu
Super User
Super User

@BruceSV 

pls  try this

Measure = DIVIDE(sum('Table'[column_numbers]),CALCULATE(sum('Table'[column_numbers]),REMOVEFILTERS('Table'[column_boolean])))

pls see the attachment below.





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

Proud to be a Super User!




View solution in original post

3 REPLIES 3
BruceSV
Frequent Visitor

Thank you for your answer. Didn't know about the removefilters() function. Will need to do some research on it. 

 

Thanks again.

you are welcome





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

Proud to be a Super User!




ryan_mayu
Super User
Super User

@BruceSV 

pls  try this

Measure = DIVIDE(sum('Table'[column_numbers]),CALCULATE(sum('Table'[column_numbers]),REMOVEFILTERS('Table'[column_boolean])))

pls see the attachment below.





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

Proud to be a Super User!




Helpful resources

Announcements
June 2022 update 768X460.jpg

Check it out!

Click here to read more about the June 2022 updates!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power BI Dev Camp Session 23 768x460.jpg

Check it Out!

Mark your calendars and join us on Thursday, June 30 at 11a PDT for a great session with Ted Pattison!

June 20 episode 7 with aka link 768x460.jpg

The Power BI Community Show

Join us on June 20 at 11 am PDT when Kim Manis shares the latest on Azure Synapse analytics, the Microsoft Intelligent Data Platform, and notable Power BI Updates from Microsoft Build 2022.

Top Solution Authors