Forum Discussion

MariusStarke's avatar
MariusStarke
Regular Visitor
1 year ago
Solved

Filter persistent Distinctcount coloumn on a related table

Hello,

I'm pretty new but not completely unexperienced. Yet this problem drives me crazy. Given are two tables. One with some ProductionOrderPlan and one with the booked capacities on them from different employees. Since we dont tracks how many pieces each employee build each day I need to filter each Capacity Entry out where more than one employee was involved. In the given picture the Capacity Ledgers for Plan1 are good while the ones for Plan2 are bad. I tried to add a filter persistent disctinctcount on the Productionorderplan to filter the desired data. unfortunately i can't get it to work. 

 

This Forum helped me a lot of times allready, but i could not find a solution to my question even though it feels quite common to me.

  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi MariusStarke ,

     

    According to your description, here are my steps you can follow as a solution.

    (1) My test data is the same as yours.

    (2) We can create a calculated column.

    NoOfEmployees =
    CALCULATE (
        DISTINCTCOUNT ( 'CapacityLedgers'[Emyployeev] ),
        FILTER (
            'CapacityLedgers',
            [ProdorderPlan] = EARLIER ( 'ProductionOrderPlan'[ProdorderPlan] )
        )
    )
    

    (3) Then the result is as follows.

     

    Best Regards,

    Neeko Tang

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

4 Replies

  • MariusStarke's avatar
    MariusStarke
    Regular Visitor

    sanalytics 

     

    I'm sorry the question didn't met the requirements. 

     

    The desired output in this case would be a persistent calculated coloumn in the ProductionOrderPlan Table which says 'NoOfEmployees' which would give 1 for Plan1 and 3 for Plan2. I hope this carifies the question.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi MariusStarke ,

     

    According to your description, here are my steps you can follow as a solution.

    (1) My test data is the same as yours.

    (2) We can create a calculated column.

    NoOfEmployees =
    CALCULATE (
        DISTINCTCOUNT ( 'CapacityLedgers'[Emyployeev] ),
        FILTER (
            'CapacityLedgers',
            [ProdorderPlan] = EARLIER ( 'ProductionOrderPlan'[ProdorderPlan] )
        )
    )
    

    (3) Then the result is as follows.

     

    Best Regards,

    Neeko Tang

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

    • MariusStarke's avatar
      MariusStarke
      Regular Visitor

      Thank you for your effort. It worked for me.