Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply

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 distint items

now i wanted to have the items which is available in all the categery and that should be dynamic like whenver i am selecting the multiple category in slicer i should view the common tests only which is available in selected category

 

can someone guide me here to acheive it?

 

1 ACCEPTED SOLUTION

Hi,

Please check the below picture and the attached pbix file.

 

Jihwan_Kim_0-1708686025850.png

 

 

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]
    )

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

View solution in original post

6 REPLIES 6

rajeshapunu1234_0-1708667326502.png

This my table below is the screen where i followed your instruction

rajeshapunu1234_2-1708667733551.png

but i am not getting proper result
can you please guid me here

 

Hi Jiwan Kim
you understood my point very clearly and it is working now

Thanks for your support

adding to that is it possible to get the item name seperately whithc distinct without package name

Only common item name (distinct) should show whenever selectes the packes in the slicer

thanks

Hi,

Please check the below picture and the attached pbix file.

 

Jihwan_Kim_0-1708686025850.png

 

 

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]
    )

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

Hi
now have anothre need
i want to have the count of the common items 
can you please give me dax to it

Sir thank you so much your DAX function working as per my expectation
so now i can get the common item from the selected category by clicing the filter "is not blank"
and i can get the other then the common items like the item can be available in both but not not matching

is it possible to take the item which is not available in the both categery by using this dax

if possible please let me know how can acheive it

thanks

 

Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file.

 

Jihwan_Kim_1-1708665031729.png

 

 

Jihwan_Kim_0-1708665016871.png

 

expected result measure: =
VAR _categorycount =
    COUNTROWS ( ALLSELECTED ( Data[Category] ) )
VAR _currentcategory =
    SELECTEDVALUE ( 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] = _currentcategory
                && Data[Item] = _currentitem
                && [@count] = _categorycount
        ),
        [@count]
    )

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

Check out the September 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

Find out what's new and trending in the Fabric Community.