cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
simo12447
Helper III
Helper III

Filter a column based on the value of another column

Hi All, 

 

stupid question.. but I really cannot fix it..

 

I am trying to distinct count the values in column A excluding the values in column B

 

A- ValueB-Exclude
11
2 
1 
2 
3 
3 
4 

 

The result should be 3... but if I do.. =CALCULATE(DISTINCTCOUNT(Table1[A]);ALLEXCEPT(Table1;Table1[B])) doesn't work.. how should I fix it?

 

thanks

Simone

 
1 ACCEPTED SOLUTION

i forget to add formula where 

Measure = CALCULATE(DISTINCTCOUNT(TableA[Column1]);FILTER(TableA;NOT(TableA[Column1] in VALUES(TableA[Column2]))))

View solution in original post

11 REPLIES 11
Bogas
Helper I
Helper I

you can create a new column and filter the page base on true 😃  or another way around 
hope this it will help 
Test.PNG

Not really because this is just a dummy example.. but I want to exclude any value from column B that appears in column A

 

Result:=CALCULATE(COUNT(Table1[Simone]),FILTER(Table1,Table1[Simone]<>Table1[Exclude]))

 

but the result should be 3.. because I consider the 1 as a value... even if not repeated

 

exampleexample

Please look atention on my solution
you saying you want to show values from column1 where is not in column 2 correct ?
then my IF create value false where the values are iqual 😃

if i filter my page where this column is all ways true you will see 1,4 and 5 excloding 2 and 3

Test.PNG

yes, your solution works in Power BI .. and I learned a new things!! thanks for that.. but I am looking a solution for power query. Let me try to create the same and I will let you know.

the same think but in mesure 😃 is this you want ?

easy.PNG

i forget to add formula where 

Measure = CALCULATE(DISTINCTCOUNT(TableA[Column1]);FILTER(TableA;NOT(TableA[Column1] in VALUES(TableA[Column2]))))

I thought I was answering... thank youuu soooo much!!! worked magically 🙂

Chapeau!!!!!!!!!!!!!

 

the same as your exemple 😃

aa.PNG

amitchandak
Super User
Super User

@simo12447 , try

calculate(distinctCOUNT(Table[A]), Table[B]<>1)

OR
calculate(distinctCOUNT(Table[A]), filter(Table,Table[B]<>1))



New Power BI Features
Datamarts: https://youtu.be/8tskWsJTEpg
Field Parameters : https://youtu.be/lqF3Wa1FllE?t=70
Did I answer your question? Mark my post as a solution! Appreciate your Kudos!! !!
Dashboard of My Blogs !! Connect on Linkedin !! Proud to be a Super User!
Want To Learn Power BI
Learn Power BI Beginners !! Advance Power BI Concepts !! Power BI For Tableau User !! Learn Power BI in Hindi !!
!! Subscribe to my youtube Channel !!

thanks @amitchandak ... but I want to add to any value in column B .. not only 1 since it is an example.

Helpful resources

Announcements
June 2022 update 768X460.jpg

Check it out!

Click here to read more about the June 2022 updates!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power BI Dev Camp Session 23 768x460.jpg

Check it Out!

Mark your calendars and join us on Thursday, June 30 at 11a PDT for a great session with Ted Pattison!

June 20 episode 7 with aka link 768x460.jpg

The Power BI Community Show

Join us on June 20 at 11 am PDT when Kim Manis shares the latest on Azure Synapse analytics, the Microsoft Intelligent Data Platform, and notable Power BI Updates from Microsoft Build 2022.

Top Solution Authors