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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
johnnyb123
New Member

Inverting Slicer output to a table

Hey all,

 

New to power bi and DAX and have come up with an issue i can not seem to solve.

 

I have two tables Computers and Applictions.

 

Applications contains [ComputerID] and [Name].

Computers contains [ComputerID] and [HostName].

Relationship is established as a one to many from 'Computers'[ComputerID] to 'Applications'[ComputerID]

 

I want to use an Applications[Name] slicer to show computers that do not have it installed.


I have created another table with just 'Application'[Names] in it called Apps

 

this is what i have tried
(This returns an error "cannot find Computers[Name] or no relationship exsists" and it does)

NoInstalled =
var selected = SELECTEDVALUE(Apps[Name],"Not Filtered")
return
IF(ISFILTERED(Apps[Name]),
CALCULATE(
CONCATENATE(RELATED(Computers[Name]),""),
Applications[Name] <> selected
),
"Not Filtered"
)

and
 
NoInstalled =
var selected = SELECTEDVALUE(Apps[Name],"Not Filtered")
return
IF(ISFILTERED(Apps[Name]),
CALCULATE(
CONCATENATEX(Computers,Computers[ComputerId],","),
Applications[Name] <> selected
),
"Not Filtered"
)
 
Tried this one just to see if the filter works as intended and it does. Obvioulsy it is just spitting out one row/column with one long string.
 
Ive seen a couple of articles about inverting sums and the like but not this.
Any heko would be greatly apreciated.
 
Thank You
1 ACCEPTED SOLUTION
v-alq-msft
Community Support
Community Support

Hi, @johnnyb123 

 

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

 

Applications:

e1.png

 

Computers:

e2.png

 

Apps(a calculated table):

Apps = DISTINCT(Applications[Name])

 

You may create a measure as below.

Visual Control = 
IF(
    ISFILTERED(Apps[Name]),
    IF(
        COUNTROWS(
            FILTER(
                DISTINCT(Apps[Name]),
                NOT(Apps[Name] in DISTINCT(Applications[Name]))
            )
        )=
        COUNTROWS(
            DISTINCT(Apps[Name])
        ),
        1,0
    ),
    1
)

 

Then you need to put the measure in the visual level filter and use the 'Name' column from 'Apps' table to filter the result.

e4.png

 

e3.png

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

6 REPLIES 6
v-alq-msft
Community Support
Community Support

Hi, @johnnyb123 

 

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

 

Applications:

e1.png

 

Computers:

e2.png

 

Apps(a calculated table):

Apps = DISTINCT(Applications[Name])

 

You may create a measure as below.

Visual Control = 
IF(
    ISFILTERED(Apps[Name]),
    IF(
        COUNTROWS(
            FILTER(
                DISTINCT(Apps[Name]),
                NOT(Apps[Name] in DISTINCT(Applications[Name]))
            )
        )=
        COUNTROWS(
            DISTINCT(Apps[Name])
        ),
        1,0
    ),
    1
)

 

Then you need to put the measure in the visual level filter and use the 'Name' column from 'Apps' table to filter the result.

e4.png

 

e3.png

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

This worked great! Thanks a bunch @v-alq-msft !

parry2k
Super User
Super User

@johnnyb123 you don't need concatenate but just a measure 

 

NoInstalled =
var selected = SELECTEDVALUE(Apps[Name],"Not Filtered")
return
IF(ISFILTERED(Apps[Name]),
CALCULATE(
COUNTROWS ( Computers ),
CROSSFILTER( Applications[ComputerId], Computer[ComputerId], Both ),
Applications[Name] <> selected
))

 

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop shop for Power BI related projects/training/consultancy.

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

wanted to give you a koodos because it works and i can use it in another project!

Thanks for the response @parry2k . I think i need to be just a tad more clear. I need the [HostName] of each computer to show as the value of a row in a table visual. The value would be a hostname record that does not have a corresponding [ComputerID] when filtered by Application[Name]. If there are 30 records after the filter is applied, there should be 30 rows in a necolumn table visual with [Hostname] as the value.

 

Again Thank you for helping.

@johnnyb123 let's make it super simple and clear, paste sample data and expected output, it will help to understand what you are trying to achieve.

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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