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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Guille_Pela
Frequent Visitor

Help DAX: Can't understand different values in measures

Hi all,

I'm working on a measure using Contoso Model and I would like to understand why I'm getting a different result using the following measures.

CONTEXT:

I have a slicer on the Product Brand and a visual showing the Customer's Country and the number of distinct orders:

Guille_Pela_0-1667078129517.png

If I choose "A. Datum", I get this:

Guille_Pela_1-1667078252332.png

CASE A:

I built a measure, "Other Brands" to get the number of orders of the other brands for the selected in the slicer:

Guille_Pela_2-1667078387591.png

I built the measure in the following way:

Guille_Pela_3-1667078499340.png

 

CASE B:

I'm trying to get the same, but building a difference measure to get the "other brands orders".

Guille_Pela_4-1667078610791.png

In place of using different measures, I'm trying to use calcute with a filter.

But the numbers I'm getting are the followings:

Guille_Pela_5-1667078722436.png

I can't figure out why I'm getting these numbers. For example, for A. Datum, 241 is in place of 231.

I can't realize where my misunderstanding is. 

Can you help me?

 

Thanks in advance!

 

 

 

1 ACCEPTED SOLUTION

I found the mistake.
CASE A is working wrong. Calculating "Other Brands" as Total - ThisBrand supposes that the intersection between both sets is null, and that is wrong. An order could have many brands inside, so in this case the order should be counted in both sets. 

View solution in original post

5 REPLIES 5
eliasayy
Impactful Individual
Impactful Individual

can you please try:

Selected Others Brand = 
VAR XBrand = SELECTEDVALUE('Product'[Brand])
Return
CALCULATE([# Orders],FILTER('Product','Product'[Brand] <>xBrand))

if this doesnt work can you please provide with calculation of # order?

 

Thanks for your answer.  I've tried it but it doesn't work. 

Guille_Pela_1-1667086978392.png

 

Guille_Pela_0-1667086950582.png

Guille_Pela_2-1667087002469.png

This is # Orders: 

Guille_Pela_3-1667087082199.png

 

 

 

ok i sampled your data is this what you desire?

Screenshot 2022-10-30 021659.png

 

 

# Total Orders = CALCULATE(DISTINCTCOUNT(Store[Order number]),Store[Name] = "Online Store",REMOVEFILTERS(Store[Brand]))

 

 

 

# Orders = CALCULATE(DISTINCTCOUNT(Store[Order number]),Store[Name] = "Online Store")

I even created both your cases and they work perfectly fine are you sure there are no missing context? 

 

Eliasavy,

The CASE A is working fine. But I would like to understand why CASE B does not work. It is supposed that the filter in this case B should get the same number but it doesn't. 

I share the file I'm using with two pages, the first which works fine and the second which doesn't.

Thanks again for your help!

 

(I brand new in the foro and I don't know how to upload a file here. I'm sharing in Google Drive)

 

Sample file .pbix 

I found the mistake.
CASE A is working wrong. Calculating "Other Brands" as Total - ThisBrand supposes that the intersection between both sets is null, and that is wrong. An order could have many brands inside, so in this case the order should be counted in both sets. 

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors