Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by watching the DP-600 session on-demand now through April 28th.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
I'm building a tornado chart that displays average salary differences by gender and pay grade. For each pay grade, I'd like to have ONE bar on the left (female) or right (male) showing the difference in average pay for that grade. If only one gender is present in that grade, then there shouldn't be a bar. The logic should be something like "if two genders are present in this pay grade, then take average of each gender and subtract smaller from larger, and add a flag stating which gender is larger." So I'm thinking I need both a new measure (the difference) and a new column (the gender flag). Attempted DAX query and chart output:
How can I structure a DAX query to accomplish this?
Solved! Go to Solution.
I have alternative visual solution. Try and see if you like it. At least it should take you half way there.
Create 2 measures and display both of them as values it on your tornado control:
Advantage F = VAR avgF = CALCULATE(AVERAGE(tbl[salary]), tbl[Gender] ="F") VAR avgM = CALCULATE(AVERAGE(tbl[salary]), tbl[Gender] ="M") VAR gap = avgM - avgF RETURN IF( gap > 0 || avgF = 0 || avgM = 0, 0, abs(gap))
Advantage M = VAR avgF = CALCULATE(AVERAGE(tbl[salary]), tbl[Gender] ="F") VAR avgM = CALCULATE(AVERAGE(tbl[salary]), tbl[Gender] ="M") VAR gap = avgM - avgF RETURN IF( gap <= 0 || avgF = 0 || avgM = 0, 0, gap)
As a result you will have presence of the bar as indicator on which gender has advantage. I hope it will help.
I have alternative visual solution. Try and see if you like it. At least it should take you half way there.
Create 2 measures and display both of them as values it on your tornado control:
Advantage F = VAR avgF = CALCULATE(AVERAGE(tbl[salary]), tbl[Gender] ="F") VAR avgM = CALCULATE(AVERAGE(tbl[salary]), tbl[Gender] ="M") VAR gap = avgM - avgF RETURN IF( gap > 0 || avgF = 0 || avgM = 0, 0, abs(gap))
Advantage M = VAR avgF = CALCULATE(AVERAGE(tbl[salary]), tbl[Gender] ="F") VAR avgM = CALCULATE(AVERAGE(tbl[salary]), tbl[Gender] ="M") VAR gap = avgM - avgF RETURN IF( gap <= 0 || avgF = 0 || avgM = 0, 0, gap)
As a result you will have presence of the bar as indicator on which gender has advantage. I hope it will help.
This is perfect. Thank you so much!
Hi @gattoun,
If you can, please share the pbix file for further testing. It is hard to clarify your scenario from screenshots.
BTW, please do mask sensitive data if your contents contains any privacy data.
Regards,
Xiaoxin Sheng
@Anonymous Here's the pbix file: https://drive.google.com/file/d/0BzgZ70kTLVb-X0RIMjlIM3VfbU0/view?usp=sharing
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 43 | |
| 38 | |
| 34 | |
| 20 | |
| 16 |
| User | Count |
|---|---|
| 65 | |
| 65 | |
| 30 | |
| 26 | |
| 25 |