Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi all,
I am stuck with a measure that should show the values that are not appearing in another table column. Below a sample :
Table1City |
Paris |
Barcelona |
Rome |
New York |
Table2City |
Paris |
Barcelona |
Rome |
New York |
Washington |
I would now like to create a Matrix visual with the City Names that are in Table 2, but not in Table 1 (in this sample it should show Washington). Note that the real data consists of 1000 different city names.
Any idea?
Thanks
Solved! Go to Solution.
@YBZ Would need to know much more about relationships, filters, etc. In theory, you could create a measure like this:
Measure = CONCATENATEX(EXCEPT(SELECTCOLUMNS('Table2',"City",[City]),SELECTCOLUMNS('Table1',"City",[City])),[City],", ")
That would return them as a list. Alternatively, you could create a column in table 2 like this:
Column =
VAR __City = [City]
VAR __Exists = COUNTROWS(FILTER('Table1',[City] = __City))
RETURN
IF(__Exists = BLANK(),1,0)
@YBZ That would be:
Measure = CONCATENATEX(DISTINCT(EXCEPT(SELECTCOLUMNS('Table2',"City",[City]),SELECTCOLUMNS('Table1',"City",[City]))),[City],", ")
@YBZ Would need to know much more about relationships, filters, etc. In theory, you could create a measure like this:
Measure = CONCATENATEX(EXCEPT(SELECTCOLUMNS('Table2',"City",[City]),SELECTCOLUMNS('Table1',"City",[City])),[City],", ")
That would return them as a list. Alternatively, you could create a column in table 2 like this:
Column =
VAR __City = [City]
VAR __Exists = COUNTROWS(FILTER('Table1',[City] = __City))
RETURN
IF(__Exists = BLANK(),1,0)
thanks a lot @Greg_Deckler. I solved it with adding the column in table 2 as you proposed 🙂
One question just for my understanding as the measure did not fully work as I have a lot of duplicate values in my columns. Therefore the result shows as well multiple times the same city name.
When I wanted to add DISTINCT(), it created an error ... Not sure where to put to have only distinct values in my column.
@YBZ That would be:
Measure = CONCATENATEX(DISTINCT(EXCEPT(SELECTCOLUMNS('Table2',"City",[City]),SELECTCOLUMNS('Table1',"City",[City]))),[City],", ")
User | Count |
---|---|
76 | |
75 | |
46 | |
31 | |
27 |
User | Count |
---|---|
99 | |
91 | |
51 | |
49 | |
45 |