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
pwissing29
Regular Visitor

Calculating the Inverse

So I have a large dataset. Its made up of 124,000 rows and 55 Columns.  One column in particular is named "Product Family"  In this column there are roughly 26 different Product Families, an example would be "Isilon", another would be "DataDomain".  Each of the 124,000 rows will have one of these 26 Product Family names in there respective row.  It is easy to pivot on all of the rows that have Isilon.  But what I need to be able to do is to create a Slicer that I can pick "Isilon" as the "Product Family"  and it shows me how many rows do not have the name "Isilon" in that row..  Same goes for "DataDomain".. I want to know how many rows do not have the name "DataDomain" in that row.  The goal is to be able to find all of my customers who are not buying a certain "Product Family".  Can someone guide me as to how to do this?  Thankyou/

1 ACCEPTED SOLUTION
v-stephen-msft
Community Support
Community Support

Hi @pwissing29 ,

 

1.Create a separate category table by entering data.

1.png

 

2.Create a measure to count, for example how many rows in the row have names other than "Isilon".

Count = 
SWITCH (
    SELECTEDVALUE ( 'Category'[Category] ),
    "Isilon",
        CALCULATE (
            COUNTROWS ( 'Table' ),
            FILTER ( 'Table', [Product Family] <> "Isilon" )
        ),
    "DataDomain",
        CALCULATE (
            COUNTROWS ( 'Table' ),
            FILTER ( 'Table', [Product Family] <> "DataDomain" )
        ),
    "ABC",
        CALCULATE (
            COUNTROWS ( 'Table' ),
            FILTER ( 'Table', [Product Family] <> "ABC" )
        ),
    "BCD",
        CALCULATE (
            COUNTROWS ( 'Table' ),
            FILTER ( 'Table', [Product Family] <> "BCD" )
        )
)

result924204.gif

 

 

You can check more details from here.

 

 

 

Best Regards,

Stephen Tao

 

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

4 REPLIES 4
v-stephen-msft
Community Support
Community Support

Hi @pwissing29 ,

 

1.Create a separate category table by entering data.

1.png

 

2.Create a measure to count, for example how many rows in the row have names other than "Isilon".

Count = 
SWITCH (
    SELECTEDVALUE ( 'Category'[Category] ),
    "Isilon",
        CALCULATE (
            COUNTROWS ( 'Table' ),
            FILTER ( 'Table', [Product Family] <> "Isilon" )
        ),
    "DataDomain",
        CALCULATE (
            COUNTROWS ( 'Table' ),
            FILTER ( 'Table', [Product Family] <> "DataDomain" )
        ),
    "ABC",
        CALCULATE (
            COUNTROWS ( 'Table' ),
            FILTER ( 'Table', [Product Family] <> "ABC" )
        ),
    "BCD",
        CALCULATE (
            COUNTROWS ( 'Table' ),
            FILTER ( 'Table', [Product Family] <> "BCD" )
        )
)

result924204.gif

 

 

You can check more details from here.

 

 

 

Best Regards,

Stephen Tao

 

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

Sooo I think i did not submit my request in teh right way. I think this is on the right path but let me give more context.  The end result is not a calculation.  The result I need is to show me all of the customers who are NOT buying "Isilon".  Say i have 20,000 customers. Out of that 20,000 lets say 5,000 are not buyng Isilon.  In other words my "Product Family" Slicer today will show me all of the customers buying Isilon because when I slice on "Isilon" i can see them all. I want somehow to create a inverse Slicer that has all of the family products in it and when i select Isilon it slices on all of the customers who dont have "Isilon".  So two slicers.  One for "Product Family" and one for "NotBuying Product Family".  Apologies for teh confusion on my ask.. But you have all been very helpful.  I am only like a month into using PBI so i am sooooo green with this. If you can tell me exactly all the steps I need to take that would be a blessing.  I want to show you some of the data but it is private.

@pwissing29 

 

See if this works for you:

First the model:

The Product Slicer table is duplicated: one for selecting the products you wish to exclude (Slicer: Select to Exclude) and the other for the final selection (Slicer: Select Final Products). Both these slicers are unrelated to the fact table.

Model.JPG

 

1) Create a measure to exclude the value(s) selected in the first slicer from the final products slicer: only the remaining products will be visible). Add this measure to the filter pane ("Filters for this visual") for "Slicer: Select Final Products" and set the value to 1.

 

 

Filter Slicer 2 = 
VAR Pres1 = VALUES('Slicer: Select to Exclude'[Exclude Product])
VAR Pres2 = VALUES('Slicer: Select Final Products'[Select from remaining])
RETURN
COUNTROWS(EXCEPT(Pres2, Pres1))

 

 

2) Create a measure to filter the customers in the final visual to exclude those which have purchased from the "Slicer: Select to Exclude". Add this measure to the filter pane ("Filters for this visual") for the target visuals and set the value to 1.

 

Filter for Visuals = 
VAR ExcludedCustomers = CALCULATETABLE(VALUES('Fact'[Customer ID]), TREATAS(VALUES('Slicer: Select to Exclude'[Exclude Product]), 'Fact'[Product Family]))
VAR Customers = CALCULATETABLE(VALUES('Fact'[Customer ID]), TREATAS(VALUES('Slicer: Select Final Products'[Select from remaining]), 'Fact'[Product Family]))
Return
COUNTROWS(EXCEPT(Customers, ExcludedCustomers))

 

 And you get this:

No filter 2.JPG

 

Visual filter.JPG

 

I've included the sample PBIX file for your reference





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






pranit828
Community Champion
Community Champion

HI @pwissing29 

Check the below link by @Greg_Deckler 

https://community.powerbi.com/t5/Quick-Measures-Gallery/Inverse-Aggregator/m-p/342266

 

It does what you asked for.





PBI_SuperUser_Rank@1x.png


Hope it resolves your issue? 
Did I answer your question? Mark my post as a solution!

Appreciate your Kudos, Press the thumbs up button!!
Linkedin Profile

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.