Forum Discussion

Namdu_PAU's avatar
Namdu_PAU
Frequent Visitor
1 year ago
Solved

Counting Rows in Different Table based on Current Row Context

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 l...
  • Namdu_PAU's avatar
    1 year ago

    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.

     

    # Allocated Techs =
    COUNTROWS(
        FILTER('Technician OEM Allocation',
            'Technician OEM Allocation'[Trained OEM] IN DISTINCT(Curriculum[Training Make])
        )
    )
     
    Final result below. For my desired calculation (percentage) I can simply do a visual calculation.