Forum Discussion

evolu6ion's avatar
evolu6ion
Frequent Visitor
7 years ago
Solved

Get total from Dimension tables

Hello,   I am facing an issue regarding calculating the total from Dimension tables using specific constraints.   Here is my dummy data: The only difference with the above data model and m...
  • Anonymous's avatar
    Anonymous
    7 years ago

    evolu6ion - Would something like this work?:

    Total product categories = 
    var fac_level = MAX('Facility Levels'[Level])
    return 
    CALCULATE(
        DISTINCTCOUNT(Products[Category]),
        RELATED('Category Levels'[Level]) <= fac_level
    )
  • evolu6ion's avatar
    evolu6ion
    7 years ago

    Anonymous  Thanks a lot! I've modified a little bit your last measure to get to the desired result. And it works on my real data!

     

    Here is the final measure:

    Total product categories = 
    var fac_level = MAX('Facility Levels'[Level])
    return 
    CALCULATE(
        DISTINCTCOUNT(Products[Category]);
        FILTER(
            ALLSELECTED(Products);
            RELATED('Category Levels'[Level]) >= fac_level
        )
    )

    In order for this to work, the cross filter direction between Facilities and Facility Levels actually has to be bidirectionnal.

     

    Once again, thank you very much!

     

    Best regards,

    N.