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.
Hey all,
First of all, thank you for taking your time to stop by and reading my help request!
I am an intermediate user of Power BI and have started to encounter difficulties with more complex logic with DAX.
Task: I would like to calculate the % of individuals in each branch that have completed the training course. To do that, I need to divide the # users completed by the # users allocated for training.
Problem: I cannot figure out the DAX code to find # users allocated for training that respects the row context in the matrix while looking at a different table that is related 2 steps away.
For example, lets say the first row calculation for Adelaide - Expert - Cert 2
If i could write it in pseudocode, it'd be something like this:
COUNTIF( USER[Location] = "Adelaide" && USER[ALLOCATED] = "Cert 2") FROM All Allocated Users
However, the confusing part for me is that the relationships are not defined clearly.
I have a table with every user, and then another table allocating users to a MAKE
Then, I have a historical table for all training performed and another table explaining the structure of the training curriculum. This also has a MAKE field.
The image below is a snippet of the table, the last column is simply a Count of all the User IDS from the ALLOCATED USERS table and is returning the full list for every row in the table. I have tried many other DAX codes but cannot get it to simply count the number of users from the ALLOCATED USERS table.
Datastructure:
Allocated Users
Curriculum
Training History
Link to PBIx: (updated link)
All help is sincerely appreciated and I will try my best to reciprocate in the community when I get better myself with Power BI.
Thank you all again!
Regards,
Namdu
Solved! Go to Solution.
Okay, so as always, I have managed to work it out by myself after a few days.
I will write down the solution so anyone else who experiences similar problems can have something to hopefully guide them.
The Issue: I am a very visual person and like seeing mid-calculations in tables. This is why I created the 'Results Table' using SUMMARIZE. I assumed that by creating this table all the previous relationships would still exist. However, what I believe is happening is that this new table is an entity on its own and therefore LOST the relationships with the other tables.
The Solution: I moved the SUMMARIZE dax code away from the new table and instead into its own measure. This kept the relationships between each of the other tables and allowed me to do a COUNTROWS between two tables.
Okay, so as always, I have managed to work it out by myself after a few days.
I will write down the solution so anyone else who experiences similar problems can have something to hopefully guide them.
The Issue: I am a very visual person and like seeing mid-calculations in tables. This is why I created the 'Results Table' using SUMMARIZE. I assumed that by creating this table all the previous relationships would still exist. However, what I believe is happening is that this new table is an entity on its own and therefore LOST the relationships with the other tables.
The Solution: I moved the SUMMARIZE dax code away from the new table and instead into its own measure. This kept the relationships between each of the other tables and allowed me to do a COUNTROWS between two tables.
please check your drop box setting ... i cant reach that. or may sahre your data on one_drive.
Hey 123abc,
That's so embarassing, i should have checked. I think I linked the previous version (which i deleted and updated).
User | Count |
---|---|
16 | |
15 | |
14 | |
12 | |
11 |
User | Count |
---|---|
19 | |
15 | |
14 | |
11 | |
9 |