Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

EXCEPT ALLSELECTED

HI!!!!

 

I have a table with costumers and year, and i have to count the numbers of costumers accordingly the year selected in the slicer, and count the numbers of costumers that less than the year that are selected. 

I tried to using this formula :

calculate(COUNT(costumers[Costumers]),ALLEXCEPT(costumers,costumers[year purchase]))

 

Help?? 

  • Hi Anonymous ,

     

    Please try the following measure:

     

    INATIVO = 
    VAR selectyear = SELECTEDVALUE ( costumers[year purchase] )
    VAR _count =
        CALCULATE (
            COUNT ( costumers[Costumers] ),
            FILTER (
                ALL ( costumers[year purchase] ),
                costumers[year purchase] > selectyear
            )
        )
    RETURN
        IF ( selectyear <> BLANK (), _count )

                    

     

    If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
    Best Regards,
    Winniz
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

9 Replies

  • Samarth_18's avatar
    Samarth_18
    Community Champion

    Hi Anonymous ,

     

    Create a measure with below code:-

     

    Selected_year =
    CALCULATE (
        COUNT ( costumers[Costumers] ),
        FILTER (
            costumers,
            costumers[year purchase] = SELECTEDVALUE ( costumers[year] )
        )
    )
    less_Selected_year =
    CALCULATE (
        COUNT ( costumers[Costumers] ),
        FILTER (
            costumers,
            costumers[year purchase] < SELECTEDVALUE ( costumers[year] )
        )
    )

    or if you need a complete count of less than and equal to selected year then use this:-

    less_equl_Selected_year =
    CALCULATE (
        COUNT ( costumers[Costumers] ),
        FILTER (
            costumers,
            costumers[year purchase] <= SELECTEDVALUE ( costumers[year] )
        )
    )

     

    Thanks,

    Samarth

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hii, Samarth!! 

       

      Thank you for the answearing, but doesn't worked. 

       

      Exemple : I filter in slicer the year of 2019, so in the formula the result have to be the amount of costumers 2020,2021 and 2022.

      • Samarth_18's avatar
        Samarth_18
        Community Champion

        Anonymous You mean you need count of customers for next 3 years of selected year?