Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi All,
I have this is in continuation of Old post . An awsome solution was given by @camargos88 using power query - join. Now I have realised that raw data size is huge and I need multiple charts and foreach combination I don't want to create join. I want to do it using DAX alone. Is it possible?
I have data like below:
State | Engineer|
Florida, Johny
Florida, Nick
Indiana, Johny
Indiana, Nick
I want a pivot table like below which shows common engineer between states.
State | Florida | Indiana |
Florida | NA | 1 |
Indiana | 1 | NA |
Santhosh K
Solved! Go to Solution.
Here you go:
In case you do not want to create a relationship between your base table the filter table:
EngineerCount =
VAR EngineerCount = VALUES('Table'[Engineer])
VAR FilterEngineerCount = CALCULATETABLE(VALUES('Table'[Engineer]);ALL('Table');TREATAS(VALUES(FilterStates[State]); 'Table'[State]))
RETURN
COUNTROWS(INTERSECT(EngineerCount;FilterEngineerCount))
In case you can create an inactive relationship:
EngineersinBotStates =
CALCULATE (
DISTINCTCOUNT ('Table'[Engineer] );
CALCULATETABLE (
SUMMARIZE ( 'Table';'Table'[Engineer] );
ALL ( 'Table');
USERELATIONSHIP ( 'Table'[State]; FilterStates[State] )
)
)
Which is based on this article:
https://www.daxpatterns.com/basket-analysis/
Result can be seen here, please note the data model and the use of a filtered states table, which is created with:
FilterStates = SUMMARIZE('Table';'Table'[State])
File is available here.
Please mark as solution if this works for you. Thumbs up for the effort is appreciated.
Kind regards, Steve.
Proud to be a Super User!
Awesome Keyboard Shortcusts in Power BI, thumbs up if you like the article
My Community Blog Articles (check them out!)
My Blog - Power M code to automatically detect column types -
How to create test data using DAX!
Here you go:
In case you do not want to create a relationship between your base table the filter table:
EngineerCount =
VAR EngineerCount = VALUES('Table'[Engineer])
VAR FilterEngineerCount = CALCULATETABLE(VALUES('Table'[Engineer]);ALL('Table');TREATAS(VALUES(FilterStates[State]); 'Table'[State]))
RETURN
COUNTROWS(INTERSECT(EngineerCount;FilterEngineerCount))
In case you can create an inactive relationship:
EngineersinBotStates =
CALCULATE (
DISTINCTCOUNT ('Table'[Engineer] );
CALCULATETABLE (
SUMMARIZE ( 'Table';'Table'[Engineer] );
ALL ( 'Table');
USERELATIONSHIP ( 'Table'[State]; FilterStates[State] )
)
)
Which is based on this article:
https://www.daxpatterns.com/basket-analysis/
Result can be seen here, please note the data model and the use of a filtered states table, which is created with:
FilterStates = SUMMARIZE('Table';'Table'[State])
File is available here.
Please mark as solution if this works for you. Thumbs up for the effort is appreciated.
Kind regards, Steve.
Proud to be a Super User!
Awesome Keyboard Shortcusts in Power BI, thumbs up if you like the article
My Community Blog Articles (check them out!)
My Blog - Power M code to automatically detect column types -
How to create test data using DAX!
Thank you steve for detailed explanantion. I really appreciate your approach.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
16 | |
13 | |
12 | |
11 | |
11 |
User | Count |
---|---|
19 | |
14 | |
14 | |
11 | |
9 |