Forum Discussion

PawelJanczak's avatar
PawelJanczak
Frequent Visitor
5 years ago
Solved

How to skip dimension slicer selection inside facts table GROUPBY operation

Hi All,   I'm tryign to resolve a problem for training purposes mainly (I have a workaround but it's basicaly several gruping operations in power query and output "stats table" loaded to model - no...
  • PawelJanczak's avatar
    5 years ago

    For anyone interested. Finally I've been able to resolve the problem. Started from scratch. According to Ultime Dax Guide, groupby is not really efficient so I did back off from it.

    [Segment] and [Year] dimensions are forced by visuals fields and visuals/page filters, so I got rid of these from syntax.

    Calculate runs sums of [Hours] iterating through all distinct products (if i get the logic correctly). ALLEXCEPT delivers to DISTINCT full list of relevant products ignoring [Country] slicer refinement. 

     

    In the end neither SUMMARIZE nor GROUPBY are needed in my scenario.

     

    MAXX(
    DISTINCT(
    ALLEXCEPT(Products,Products[ProductSegment])
    ),
    CALCULATE(
    SUMX(
    'ProductCosts',
    'ProductCosts'[Hours]
    )
    )
    )