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.
Dear community team,
I'm trying to get the last column in the table below, given that I have a long list of activites, where some things might be repeated.
The feeling is that DISTINCTCOUNT should be somehow involved with maybe CALCULATE + FILTER, but I cannot grasp the idea how exactly I can do that.
Any suggestions how to achieve this using DAX / Query Editor?
Cheers,
Misha
Country | Company | Activity | Cost, USD | In which country the company operates? |
USA | A | License purchase | 100 | Both |
USA | B | Power BI training | 150 | USA |
USA | B | Tableau uninstall | 0 | USA |
USA | C | AI / ML training | 100 | Both |
Canada | A | New visuals dev | 10 | Both |
Canada | D | Request processing | 5 | Canada |
Canada | C | Dog walking | 100 | Both |
Solved! Go to Solution.
Hi @Anonymous
Try this for a calc column:
NewCol = VAR Countries_ = CALCULATETABLE ( DISTINCT ( Table1[Country] ), ALLEXCEPT ( Table1, Table1[Company] ) ) RETURN SWITCH ( COUNTROWS ( Countries_ ), 1, Table1[Country], 0, BLANK (), "Both" )
Please mark the question solved when we get to the solution and consider kudoing if posts are helpful.
Cheers
Hi @Anonymous
Try this for a calc column:
NewCol = VAR Countries_ = CALCULATETABLE ( DISTINCT ( Table1[Country] ), ALLEXCEPT ( Table1, Table1[Company] ) ) RETURN SWITCH ( COUNTROWS ( Countries_ ), 1, Table1[Country], 0, BLANK (), "Both" )
Please mark the question solved when we get to the solution and consider kudoing if posts are helpful.
Cheers
Amazing! Many thanks for the quick reply!
Cheers,
Misha
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
98 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
101 | |
86 | |
64 |