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
aallman
Helper I
Helper I

Need help quick! Percent On Time measure not working with filters?

I have a whole page dedicated to exploring our products that have shipped late, meaning there is a page filter for [On Time Ship]="False". I also have a measure to calculate the % on time for each product. The formula is:

% On Time = CALCULATE(DISTINCTCOUNT(CVD_OTD_FTMS_IV[Reference Number]),CVD_OTD_FTMS_IV[On Time Ship]=true(),REMOVEFILTERS(CVD_OTD_FTMS_IV[On Time Ship]))/CALCULATE(DISTINCTCOUNT(CVD_OTD_FTMS_IV[Reference Number]),REMOVEFILTERS(CVD_OTD_FTMS_IV[On Time Ship]))​

where [Reference Number] is the unique identifier for someone's ordered item.

This measure isn't working the way I want it to and I am not sure why. The count of late items works as expected, but the total count (or denominator in my % on time measure) doesn't show what I expect unless I remove the page filter for [On Time Ship]="False". I don't know why this would be the case since I have a RemoveFilters command in the measure formula??

 

For example, the product below shows this with the page filter applied:aallman_0-1683220937036.png

and the same product without the page filter applied:

aallman_2-1683221218947.png

 

The real total count is 277 for this product. Why is it only 55 when the page filter is applied??

I need help rather quickly, please and thank you!!

 

 

6 REPLIES 6
BiNavPete
Resolver III
Resolver III

Without the PBIX a tricky one, but here goes.

Power BI will work within the context of the row it is looking at.
To remove the context use the ALL or possibly ALLSELECTED Keyword in your calculate measures.
So any measure referring to CVD_OTD_FTMS_IV should wrap ALL(CVD_OTD_FTMS_IV) in it s CALCULATE.

 

Pete

You mean in place of the REMOVEFILTERS part of the formula? I am not sure where to put ALL in this formula:

CALCULATE(DISTINCTCOUNT(CVD_OTD_FTMS_IV[Reference Number]),REMOVEFILTERS(CVD_OTD_FTMS_IV[On Time Ship]))

yes in place of the REMOVEFILTERS

That didn't work, if I use ALLSELECTED the value becomes 25 just like the late count. If I use ALL then the value becomes 4M which is the total rows I have in my dataset.

Not sure where to go next without a PBIX to work with.

Sorry

Pete

aallman
Helper I
Helper I

I also don't know where the 55 is coming from when the page filter is on. I can't figure out which 55 lines are being included and why.

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.

Top Solution Authors