Forum Discussion

spinkung's avatar
spinkung
New Member
10 years ago

Distinct count from another table (i think)

Hi

 

First post so go easy :)

 

I have created a model which has a sales table, customer table and product table. 

 

I'm trying to create a card in BI Desktop which, when filtered by product range, shows me the number (distinct count) of stores the range is sold in.

 

I have created a measure in my sales table.....

 

Sales CY Stores =
CALCULATE (
DISTINCTCOUNT (Customers[Store Name]),
'Sales - Current Year'[SalesValue]
)

 

...but the result is i always get the total number of stores (251) in my customer table regardless of the filters. e.g. product range 1 should show 30 stores.

 

Can anyone help?

 

Thanks

3 Replies

  • Need to look at your data model and are they all connected by relationships. 

    What are the primary and foreign keys in each table.

    what exactly you are trying to do.

     

    Please provide me the answer of this question or the sample data file, more than happy to look into your problem.

     

  • Eric_Zhang's avatar
    Eric_Zhang
    Microsoft Employee

    ...but the result is i always get the total number of stores (251) in my customer table regardless of the filters. e.g. product range 1 should show 30 stores.


    spinkung

    Most probably there's no relationship between customer and product table. If a Many:Many relationship, please reference the attached pbix.

     

     

     

     

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Sales CY Stores =
      CALCULATE (
      DISTINCTCOUNT (Customers[Store Name]),
      'Sales - Current Year'[SalesValue]
      )

       

      This doesn't even look "legal" to me... what is that param!?