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
Boycie92
Resolver I
Resolver I

DAX help - when filtering reports

Hi,

I’m wondering if someone can help.

 

I have the following Measures:

 

No of Sales = CALCULATE(COUNTROWS(Sales),Sales[Time Period] = "<= 28 days")

 

No of Records = COUNTROWS(Sales)

 

% = DIVIDE([No of Sales],CALCULATE([No of Records],ALL(Sales)),0)

 

The % measure works perfect at the high level when I don’t have any filters applied.

 

However When I apply a filter (MonthYear) the calculation will show me the “correct” result because it will show me a percentage based on all records across all Dates.

 

However I would like that % to be calculated based on my filter selection. So if I filtered the report using April 2017 the measures will only look at the rows within that date range and calculate the percentage.

 

Can anyone advise me on how to achieve this?

 

Thanks in advance,

Boycie92

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @Boycie92,

 

When you are calculating the overall percentage you have overlaping the filters in the context and choosing all of the data, that is why your overall calculations are differente because you are calculating the month values over all sales you need to use ALLSELECTED.

 

% = DIVIDE([No of Sales],CALCULATE([No of Records],ALLSELECTED(Sales)),0)

Regards,

MFelix


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

2 REPLIES 2
MFelix
Super User
Super User

Hi @Boycie92,

 

When you are calculating the overall percentage you have overlaping the filters in the context and choosing all of the data, that is why your overall calculations are differente because you are calculating the month values over all sales you need to use ALLSELECTED.

 

% = DIVIDE([No of Sales],CALCULATE([No of Records],ALLSELECTED(Sales)),0)

Regards,

MFelix


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



It works!

 

Thanks @MFelix

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.