Forum Discussion
jmhoskinson
6 years agoHelper I
Change X Axis Dynamically
Hi Everyone, I'm wanting to dynamically change my X axis for a bar chart. If the Regions filter has an option selected, I want to X axis to show account executives; if the Regions filter is not fil...
Icey
6 years agoCommunity Support
Hi jmhoskinson ,
Please check:
1. Create tables.
RegionAccount =
VAR t1 =
SUMMARIZE ( Users, Users[Region], Users[Account Executive] )
VAR t2 =
ADDCOLUMNS ( t1, "Axis Dimension", "Region", "Axis Value", [Region] )
VAR t3 =
ADDCOLUMNS (
t1,
"Axis Dimension", "Account Executive",
"Axis Value", [Account Executive]
)
RETURN
UNION ( t2, t3 )
Region = DISTINCT(Users[Region])Account Executive = DISTINCT(Users[Account Executive])
2. Create relationships.
3. Create measures.
Axis Dimension Selected =
SWITCH (
TRUE (),
ISFILTERED ( Users[Region] ), "Region",
ISFILTERED ( Users[Account Executive] ), "Account Executive"
)
CountDeal = COUNT(Deals[Deal Owner])Count =
IF (
NOT ( ISBLANK ( [Axis Dimension Selected] ) ),
SWITCH (
[Axis Dimension Selected],
"Region", CALCULATE (
[CountDeal],
USERELATIONSHIP ( RegionAccount[Account Executive], 'Account Executive'[Account Executive] ),
FILTER ( RegionAccount, [Axis Dimension] <> "Region" )
),
"Account Executive", CALCULATE (
[CountDeal],
USERELATIONSHIP ( RegionAccount[Region], Region[Region] ),
FILTER ( RegionAccount, [Axis Dimension] <> "Account Executive" )
)
)
)
4. Create visuals.
5. Test.
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
jmhoskinson
6 years agoHelper I
Hi Icey and amitchandak - I really appreciate the help, but my requirement is that I can't be doing anything new to my data model.