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!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
I am trying to find the StDev of values for a filter, but I need to merge the data from two columns in my table first.
This is what I have tried, but I cannot figure out how to merge columns in a Variable, and then reference one of those columns in a filter,I know other ways to do it, I am just trying to figure it out in a DAX formula for my own satisfaction at this point. Any help would be appreciated!
City 1 | State 1 | Number 1 | City 2 | State 2 | Number 2 |
NewYork | NY | 1 | Boston | MA | 4 |
Minneapolis | MN | 7 | Chicago | IL | 17 |
Boston | MA | 5 | NewYork | NY | 6 |
Chicago | IL | 12 | Minneapolis | MN | 60 |
New Table:
City | State | Number |
NewYork | NY | 1 |
Minneapolis | MN | 7 |
Boston | MA | 5 |
Chicago | IL | 12 |
Boston | MA | 4 |
Chicago | IL | 17 |
NewYork | NY | 6 |
Solved! Go to Solution.
" RETURN
UNION"
You are missing the second Filter. But even then you can only return this into a calculated table. A measure can only be a scalar value.
Here is the DAX that results in a calculated table:
AllCitys =
VAR VARTable = FILTER(
UNION(
SELECTCOLUMNS(ShipmentInfo,"Number",ShipmentInfo[Number 1]),
SELECTCOLUMNS(ShipmentInfo,"Number",ShipmentInfo[Number 2]))
,[Number] <> 9999 && [Number] >=0 )
RETURN
FILTER(UNION(
SELECTCOLUMNS(ShipmentInfo,"City",ShipmentInfo[City 1],"State",ShipmentInfo[State 1],"Number",ShipmentInfo[Number 1]),
SELECTCOLUMNS(ShipmentInfo,"City",ShipmentInfo[City 2],"State",ShipmentInfo[State 2],"Number",ShipmentInfo[Number 2]))
, [Number] <= STDEVX.P(VARTable,[Number]))
Thank you!
" RETURN
UNION"
You are missing the second Filter. But even then you can only return this into a calculated table. A measure can only be a scalar value.
Here is the DAX that results in a calculated table:
AllCitys =
VAR VARTable = FILTER(
UNION(
SELECTCOLUMNS(ShipmentInfo,"Number",ShipmentInfo[Number 1]),
SELECTCOLUMNS(ShipmentInfo,"Number",ShipmentInfo[Number 2]))
,[Number] <> 9999 && [Number] >=0 )
RETURN
FILTER(UNION(
SELECTCOLUMNS(ShipmentInfo,"City",ShipmentInfo[City 1],"State",ShipmentInfo[State 1],"Number",ShipmentInfo[Number 1]),
SELECTCOLUMNS(ShipmentInfo,"City",ShipmentInfo[City 2],"State",ShipmentInfo[State 2],"Number",ShipmentInfo[Number 2]))
, [Number] <= STDEVX.P(VARTable,[Number]))
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.