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!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi Everyone,
I have a column chart in Power BI which shows statewise sales. I have a slicer for states. The requirement is, if the user selects only one state in the slicer, the table should show citywise sales for that respective state. If the user selects more than one state in the slicer, I want to show statewise sales.
I tried using the following DAX formula:
Column = IF(COUNTROWS(VALUES(Orders[State])) = 1, VALUES(Orders[City]), VALUES(Orders[State]))
However, I'm getting an error message:
MdxScript(Model) (4, 76) Calculation error in measure 'DAX Measures'[Column]: A table of multiple values was supplied where a single value was expected.
Can someone please help me with this? Any help would be appreciated.
Thanks!
Solved! Go to Solution.
Hi @wickkey
I've attached an example of how this can be done. It's an interesting application of field parameters.
Field parameters are a preview feature so need to be enabled in the "Preview features" settings.
Does this work in your report?
State/City Filter =
-- SingleState = 1 if a single state has been selected on slicer, otherwise 0
VAR SingleState =
INT (
CALCULATE ( HASONEVALUE ( Orders[State] ), ALLSELECTED () )
)
-- CityOption = 1 if the current Field Parameter option = City, otherwise 0
VAR CityOption =
INT ( MIN ( 'State/City'[State/City] ) = "City" )
RETURN
-- Return 1 if SingleState & CityOption both = 1 (display city), or if SingleState & CityOption both = 0 (display state)
INT ( SingleState = CityOption )
I really appreciate your help. Your response was exactly what I needed. Thank you for taking the time to help me out! 😊
Hi @wickkey
I've attached an example of how this can be done. It's an interesting application of field parameters.
Field parameters are a preview feature so need to be enabled in the "Preview features" settings.
Does this work in your report?
State/City Filter =
-- SingleState = 1 if a single state has been selected on slicer, otherwise 0
VAR SingleState =
INT (
CALCULATE ( HASONEVALUE ( Orders[State] ), ALLSELECTED () )
)
-- CityOption = 1 if the current Field Parameter option = City, otherwise 0
VAR CityOption =
INT ( MIN ( 'State/City'[State/City] ) = "City" )
RETURN
-- Return 1 if SingleState & CityOption both = 1 (display city), or if SingleState & CityOption both = 0 (display state)
INT ( SingleState = CityOption )
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 93 | |
| 81 | |
| 73 | |
| 46 | |
| 35 |