Forum Discussion

rajeshapunu1234's avatar
2 years ago
Solved

Finding the common item from the multiples category

Dear team,   I am having a situation like i am having Table name called category and which table is having category and item column the category column and many caterogy and each category have dis...
  • Jihwan_Kim's avatar
    Jihwan_Kim
    2 years ago

    Hi,

    Please check the below picture and the attached pbix file.

     

     

     

    expected result measure only item: = 
    VAR _categorycount =
        COUNTROWS ( ALLSELECTED ( Data[Category] ) )
    VAR _currentcategory =
        VALUES( Data[Category] )
    VAR _currentitem =
        SELECTEDVALUE ( Data[Item] )
    VAR _t =
        ADDCOLUMNS (
            ALLSELECTED ( Data ),
            "@count", COUNTROWS ( FILTER ( ALLSELECTED ( Data ), Data[Item] = _currentitem ) )
        )
    RETURN
        SUMX (
            FILTER (
                _t,
                Data[Category] in _currentcategory
                    && Data[Item] = _currentitem
                    && [@count] = _categorycount
            ),
            [@count]
        )