Inconsistent Measure Responses

pjmorris

Well-known Member
Joined
Aug 2, 2012
Messages
2,162
Office Version
  1. 365
Platform
  1. Windows
I have two measures which give different results, yet as far as I can see they are fundamentally identical. Grateful for any thoughts. (Note, although the code snippets say PowerQuery they're actually DAX measures in PowerPivot)

The first measure returns 3325 and is defined as:

Power Query:
CountApproved=CALCULATE(DISTINCTCOUNT(qryVault[Babcock Doc No]), qryDDM,
    ALL(qryDDM[RACI]),  qryDDM[RACI]="A",
    qryVault[Issued Date]>0,
    qryVault[Status]<>"Superceded",
    qryVault[Status]<>"Obsolete"
)

The second returns 3294 and is defined as:

Power Query:
CountRACIisA=CALCULATE([CountAllIssued], ALL(qryDDM[RACI]), qryDDM[RACI]="A")

with [CountAllIssued] defined as:

Power Query:
CountAllIssued=CALCULATE(DISTINCTCOUNT(qryVault[Babcock Doc No]), qryDDM,
    qryVault[Issued Date]>0,
    qryVault[Status]<>"Superceded",
    qryVault[Status]<>"Obsolete"
)

My reading of these measures is that fundamentally the CountApproved and CountRACIisA are identical. However, if I remove qryDDM[RACI]="A" from [CountApproved] it makes no difference , whereas if I remove it from [CountRACIisA] the result is 3325. Which suggests that the qryDDM[RACI]="A" is not being considered in the filter context of [CountApproved].

I'm confused.

Regards
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Maybe there is a way to simulate how the measures are calculated by the engine.
For the combined measures, you actually have a calculate inside a calculate, thus you remove filter context twice and create a new filter. The first measures is a single calculate, and the new filter is defined using all. The way these are calculated by the engine is very different. Now I'm not at that level I can immediately explain the difference in the result without seeing data.

I remember I saw a video on a similar issue on the website of the Italians Ferrari and Russo Home - SQLBI. Maybe you find some answers over there as well. Sorry, I don't recall exactly the name of the video. It did feature all and calculate in measures that look the same, but return different results.
 
Upvote 0

Forum statistics

Threads
1,214,983
Messages
6,122,591
Members
449,089
Latest member
Motoracer88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top