Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago

Distinct Count

I am working on a data set, in which i want to select the atheletes participated in an event from a particular year. The Dax that i am using for E.g for year 2004 is 

Athletes in 2004 = CALCULATE(DISTINCTCOUNT('Summer-Olympic-medals-1976-to-2'[Athlete ID]),'Calendar'[Year]=2004). The result i am getting(1832) is totally different from the actual value(1381). I am unable to figure out what is wrong.

6 Replies

  • AbhinavJoshi's avatar
    AbhinavJoshi
    Responsive Resident

    Hi Anonymous .

    Can you please provide a sample of your data model?
    General advice would be looking for filters coming to your visual.

  • Hi,

    There is no mistake in your measure.  However, you should not hard code 2004 in the filter argument of the Calculate function.  Create a year slicer from the Calendar Table and select 2004 there.  Simplify your measure to

    Athletes = DISTINCTCOUNT('Summer-Olympic-medals-1976-to-2'[Athlete ID])

    Hope this helps.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank You Ashish. I will try this and see how it goes.

      Regards

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

    Have you solved your problem? If so, can you share your solution here and mark the correct answer as a standard answer to help other members find it faster? Thank you very much for your kind cooperation!

     

     

    Best Regards,

    Clara Gong

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Clara,

      It worked and the problem was actually with my time settings on Laptop and regional settings of powerbi which was giving alterered results to time intelligence DAX