Forum Discussion

tkwh1's avatar
tkwh1
Frequent Visitor
2 years ago
Solved

show values in data table filtered under different conditions

Hello all,  I need help with DAX code that would produce results in a matrix table under the following conditions.  So far not much luck..   Conditions For example, i have the following data with...
  • Anonymous's avatar
    Anonymous
    2 years ago

    HI tkwh1,

    It seems like I missed the first condition to filter items which 'Invoiced' field equal to 'No' , you can try to the following measure formula if it suitable for your requirement:

    Distinct Shipped Count Per Inventory =
    VAR InventoryList =
        CALCULATETABLE (
            VALUES ( Table1[Inventory] ),
            FILTER ( ALLSELECTED ( Table1 ), [Invoiced] = "No" )
        )
    RETURN
        CALCULATE (
            COUNTROWS ( VALUES ( Table1[Shipped] ) ),
            FILTER (
                ALLSELECTED ( Table1 ),
                [Invoiced] = "Yes"
                    && [Inventory] IN InventoryList
            ),
            VALUES ( Table1[Inventory] )
        )

    Regards,
    Xiaoxin Sheng