Forum Discussion

BHAVIKCHAWLA's avatar
BHAVIKCHAWLA
New Member
2 years ago
Solved

Not able to calculate distinct count

Hi All, I am facing issue in calculating distinct count. I am sharing sample data with you. First sheet is date table which I have created. 4th sheet is output I need. I cant see option to atta...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi BHAVIKCHAWLA 

     

    Thanks dufoq3  for the power query method. Here is a solution without using power query. 

    Firstly, as the second table includes match dates, we can extract years from matchDate column to have a new Year column. This can be done with either DAX or Power Query. Then we need only the second and third table in our model. The first table is not needed. 

    Connect two tables on match_id column. Modify the cross-filter direction to Both

    Then you can add batsmanName and Year column into a table visual, set Year's aggregation to Count(Distinct). You can also create a measure like 

    Played Years = DISTINCTCOUNT(Table2[Year]) 

     

    Best Regards,
    Jing
    If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!