Forum Discussion

posterme's avatar
posterme
Frequent Visitor
8 years ago

Slicer - How can I count selected months?

Hi Guys,

 

how can I or is it possible to count how many months I have selected in a Date-Slicer? I want to divide a value with the count of monts, e.g. earnings / selected months ... All variants do not show me the correct number of months - only distinctcount brings 12 months ;)

 

Thanks in advance

13 Replies

  • vega's avatar
    vega
    Icon for Resolver III rankResolver III
    Count = 
    IF(
        ISFILTERED(Months[Month]),
        COUNT(Months[Month]),
        0
     )

    This will count if the months column is selected directly. If you want to account for the months column being filtered indirectly, use ISCROSSEDFILTERED instead of ISFILTERED.

    • posterme's avatar
      posterme
      Frequent Visitor

      Hi Vega,

       

      thank you - unfortunately, the value is always "0" instead of, in this example, "5":

       

       

      BR

      • vega's avatar
        vega
        Icon for Resolver III rankResolver III

        Can you post your Date table? How is the slicer being created? Like I said earlier, if the months are not being filtered directly, then you need to use ISCROSSFILTERED.

  • hi

    I have also tried this solution using "ISFILTERED" or "ISCROSSEDFILTERED" and both options only 

    result in 0. I have two items selected in my slicer. Regards

  • Months Counted in Slicer =
    IF(
        ISCROSSFILTERED('Date Table'[Month]),
        DISTINCTCOUNT('Date Table'[Month])
    )