DAX newbie - how to calculate these two formulas

LRMMF

New Member
Joined
Mar 5, 2015
Messages
16
Hi,

imagine that you have 3 tables:
Table Fact Seller : seller_code, seller_name, manager_code
Table Fact Manager : manager_code, manager_name
Table Fact Product : product_code, product_name, seller_code

Relations have been made between keys

I want to calculate two aspects:

1) The number of active sellers. A Seller is active if it has any (1 or more) product in Fact Product.

i would like to know how i can i calculate this. it would be something like
=CALCULATE(DISTINCTCOUNT('Fact Seller'[seller_code]);[filter here]))

In [filter here] i need something like FILTER(COUNTROWS('Fact Product';'Fact Product'[manager_code])>=1), to get only the sellers from fact seller who have at least one product in fact product. I think i need to use the keyword VALUES() but i didn't find the correct syntax.

i would like to know what is better way or pattern for doing this.

2) The number of sellers with managers. Please note that when data is retrieved, if a seller has no manager the field manager_code has value "-1". So i can do this:
=CALCULATE(DISTINCTCOUNT('Fact Seller'[seller_code]);FILTER('Fact Seller';'Fact Seller'[manager_code]>=1))
So this is a filter inside the table. This works, but i would like to know if there is a better way or pattern for this.

Can you help out ? :)

kind regards
 
Well, I wouldn't have given that measure if I didn't think it worked... :-P I actually just mocked up a sample workbook and it worked fine for me. I'm not exactly sure what was being attempted in your #1 or #2, but they don't look super close to me.
 
Upvote 0

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Well, I wouldn't have given that measure if I didn't think it worked... :-P I actually just mocked up a sample workbook and it worked fine for me. I'm not exactly sure what was being attempted in your #1 or #2, but they don't look super close to me.

You're right :) sorry i was writting on my phone, over a busy day, what i meant was if, from all the 3 formulas, if they had any problem with the syntax.
 
Upvote 0

Forum statistics

Threads
1,224,078
Messages
6,176,244
Members
452,716
Latest member
Elo

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