Forum Discussion

coskunfirat's avatar
coskunfirat
Frequent Visitor
3 years ago

Distinctcount from unrelated table

Hello All,

Maybe it's a very easy issue but I could not find a good solution.

 

I'm trying to compute the count of how many Device_Uniq_ID we have, but I'm not getting the expected result. There is no direct relation with Dim_Date, Dim_Company, and Dim_Customer.

 

The attached image is a part of my data tables ( I have another 2 fact tables and a few dim tables)

 

Could you please help me to find the solution to Count the device's unique Id by dim_date, dim_company, and dim_customer?

What's the best solution to solve this issue?

 

Thank you in advance for your valuable support.

 

 

 

 

1 Reply

  • Hi coskunfirat 

    It sounds like a related distinct count pattern would apply here.
    Something like this (applying the pattern from the page linked):

     

    Device_Uniq_ID related distinct count =
    VAR Device_Uniq_ID_From_Fact =
        SUMMARIZE ( Fact, Dim_Device[Device_Uniq_ID] )
    VAR Result =
        SUMX ( Device_Uniq_ID_From_Fact, 1 )  -- optimization for COUNTROWS ( Device_Uniq_ID_From_Fact )
    RETURN
        Result

     

     

    Does this work as intended?