Forum Discussion

Kebas_Leech's avatar
Kebas_Leech
Icon for Helper I rankHelper I
3 years ago
Solved

Unchanged Results by Multiple Filters

Hello everyone,   I need to calculate the sum of a distinct count of  ( KZ_[OT] ). This sum is displayed in a table according to two filters, ( KZ_[Product] ) and (  KZ_[Type] ). The thing is, I ha...
  • Kebas_Leech's avatar
    Kebas_Leech
    3 years ago

    I found the solution:

     

    var testing =
    
    Calculate(
              sumx(
                   summarize( 
                             KZ_,
                             KZ_[Year]  
                            ),
                     DISTINCTCOUNT(KZ_[OT])
                   ),
        ALL(KZ_[Month]),ALL(KZ_[Product]), ALL(KZ_[Product_Line]) , KEEPFILTERS(KZ_[Year] = 2022)
    )
    return testing

     

    Obviously this code works for my particularly case however what i got from this was:

    - The code wasn't working properly because allselected only works for the selected cases in the filter, so when I chose January, in the Segmentation Bar, he was only filtering for the products of January.. even if using all([Kz_[Month]).

    - The second thing was (this one i still dont understand the reason behind it): I had my month column changed to Kz_[MonthName] and I was using it in the Segmentation Bar. However, when i changed this column to the original column kz_[Month] (numeric) it worked.