Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
Dear Forum Members,
I have a data table of individuals' records of receiving service in welfare agencies. The data table has service start and end dates from which I can calcuate the length of stay (and its categories) in service. The table also has client demographics, such as age, gender, and race.
I want to know the number of records (exits) who exit services in each category of length of stay, and I would also like to break down the numbers by gender and race and age.
In the screenshot below, the first matrix visual is for gender. The two values in are the number of exits (a Dax Measure) for each gender, and the total exits (also a DAX Measure for all gender row total). In the following DAX measure for row total [M_Exits_nol_gender], [M_Exits_Sum] is the measure for number of exits (just simple sum of records). I use ALL(Excel_eachstate[gender]) as a filter to get the row total for each Length of Stay category acoss the genders. For example, the row total for row header 'one week' is 76340. It seems I can also use ALLSELECTED in place of ALL to get the row total.
M_Exits_nol_gender = CALCULATE(
[M_Exits_Sum],
ALL(Excel_eachstate[gender])
)However, when I created and used a similar DAX Measure for row total in the Matrix for Race (and age), the matrix visuales do not show the row total (eg. 76340 for "one week") but the same as the number for each gender category. See 2nd table abvoe. Following is the DAX measure for the row total across race (racecat4).
M_Exits_nol_race = CALCULATE(
[M_Exits_Sum],
All(Excel_eachstate[racecat4])
)Does anyone know what is the reason for this? Is there anyway I can get the DAX measure to work correct?
Besides creating the DAX measrue for row total separately for gender and race (and age), I would also like to create one single Matrix visual and use a fields parameter of Gender, race and age as a slicer and as a column of the matrix. This can show the values of numbe of exits and row totals dynamically depending on the selected fields in the slicer. See 3rd table and slicer in screenshot. But in this case, I wonder how I can create a DAX measure dynamically for the selected slicer field. I tried to write the DAX measure:
@Anonymous , to me seems like you want to switch measures using selectedvalue of field parameter. I am using two parameters, but you can use var and create dynamic measure
Switch TOPN with Field Parameters: https://amitchandak.medium.com/switch-topn-with-field-parameters-299a0ae3725f
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Check out the February 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 52 | |
| 50 | |
| 34 | |
| 15 | |
| 14 |
| User | Count |
|---|---|
| 92 | |
| 77 | |
| 41 | |
| 26 | |
| 25 |