Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

DAX filter calculated table based on another table

Hello,   Please assist me with this DAX measure I'm trying to calculate the sum of inventory based on the countries for a selected user. I have attached my pbix file with the measure  called "Tota...
  • selimovd's avatar
    4 years ago

    Hey Anonymous ,

     

    I think I found an easier way.

    First I get the countries for the current user and then I just use that list as a filter for calculate.

     

    Check the following approach:

    TotInventory =
    -- Get all countries for the current user
    VAR vCountries =
        CALCULATETABLE(
            VALUES( data[Country] ),
            ALLEXCEPT(
                data,
                data[User Name]
            )
        )
    RETURN
        -- return the [SumOfInventoryProcessed] and we use
        -- as only filter the countries from the first step
        CALCULATE(
            [SumOfInventoryProcessed],
            vCountries,
            ALL( data )
        )

     

    If you need any help please let me know.
    If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
     
    Best regards
    Denis