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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
Hedan
Frequent Visitor

Only show Sales Orders that only contains items of a specific type

Hello,
I have a table containing data of this structure:

Hedan_1-1700744817610.png

 

I have put these three columns in a table visual. I want to create a slicer called "Only service items" that contains value TRUE/FALSE. If TRUE is picked in the slicer then I would like the visual to only show SalesID's that only contains rows of ItemType = Service. 

Expected result:

Hedan_2-1700745020153.png

 

Would anyone be so kind as to point me in the right direction.

Thanks!




1 ACCEPTED SOLUTION
FreemanZ
Super User
Super User

hi @Hedan ,

 

not sure if i fully get you, try to 

1) plot a slicer with a calculated table like:

Slicer = 
SELECTCOLUMNS(
     {TRUE, FALSE},
    "OnlyServiceItem", [Value]
)

 

2) plot a table visual with all three columns and pull a measure like below to the filter pane of the visual and choose 1:

measure = 
VAR _selection = SELECTEDVALUE(Slicer[OnlyServiceItem])
VAR _salesid = MAX(data[salesid])
VAR _list = 
CALCULATETABLE(
    VALUES(data[itemtype]),
    ALL(data),
    data[salesid] = _salesid
)
VAR _result =
IF(
    _selection=FALSE(),
    1,
    IF(
        _selection=TRUE 
            && "Service" IN _list 
            && COUNTROWS(_list)=1,
        1,0
    )
)
RETURN _result

 

it worked like:

FreemanZ_2-1700749469150.png

FreemanZ_3-1700749495152.png
FreemanZ_4-1700749508523.png

View solution in original post

2 REPLIES 2
FreemanZ
Super User
Super User

hi @Hedan ,

 

not sure if i fully get you, try to 

1) plot a slicer with a calculated table like:

Slicer = 
SELECTCOLUMNS(
     {TRUE, FALSE},
    "OnlyServiceItem", [Value]
)

 

2) plot a table visual with all three columns and pull a measure like below to the filter pane of the visual and choose 1:

measure = 
VAR _selection = SELECTEDVALUE(Slicer[OnlyServiceItem])
VAR _salesid = MAX(data[salesid])
VAR _list = 
CALCULATETABLE(
    VALUES(data[itemtype]),
    ALL(data),
    data[salesid] = _salesid
)
VAR _result =
IF(
    _selection=FALSE(),
    1,
    IF(
        _selection=TRUE 
            && "Service" IN _list 
            && COUNTROWS(_list)=1,
        1,0
    )
)
RETURN _result

 

it worked like:

FreemanZ_2-1700749469150.png

FreemanZ_3-1700749495152.png
FreemanZ_4-1700749508523.png

This worked, thank you!

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors