Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
I would like to make a bar chart that can control by the slicers of "Start Year" and "End Year". Pic 1 is what the slicers look like and Pic 2 is the target I would like to achieve
Pic2:
And I have made the slicer with
Solved! Go to Solution.
Hi @henry24007 ,
You can try the following to achieve the effect of dynamic axes.
Calculated_tale_Utils_ =
VAR customer =
SELECTCOLUMNS (
ADDCOLUMNS (
DISTINCT ( 'DimCustomer'[EnglishOccupation] ),
"Type", "Profession"
),
"Name", [EnglishOccupation],
"Type", [Type]
)
VAR product1 =
SELECTCOLUMNS (
ADDCOLUMNS ( DISTINCT ( 'DimProduct'[Color] ), "Type", "Color" ),
"Name", [Color],
"Type", [Type]
)
RETURN
UNION ( customer, product1 )dynamic =
VAR RS_Color =
TREATAS ( VALUES ( 'Calculated_tale_Utils_'[Name] ), DimProduct[Color] )
VAR M_Color =
CALCULATE ( [Amount_filter], RS_Color )
VAR RS_Occupation =
TREATAS ( VALUES ( 'Calculated_tale_Utils_'[Name] ), DimCustomer[EnglishOccupation] )
VAR M_Occupation =
CALCULATE ( [Amount_filter], RS_Occupation )
RETURN
SWITCH (
TRUE (),
SELECTEDVALUE ( 'Calculated_tale_Utils_'[Type] ) = "Color", M_Color,
SELECTEDVALUE ( 'Calculated_tale_Utils_'[Type] ) = "Profession", M_Occupation,
M_Color
)
If the problem is still not resolved, please provide detailed error information and test data. Looking forward to your reply.
Best Regards,
Henry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @henry24007 ,
You can try the following to achieve the effect of dynamic axes.
Calculated_tale_Utils_ =
VAR customer =
SELECTCOLUMNS (
ADDCOLUMNS (
DISTINCT ( 'DimCustomer'[EnglishOccupation] ),
"Type", "Profession"
),
"Name", [EnglishOccupation],
"Type", [Type]
)
VAR product1 =
SELECTCOLUMNS (
ADDCOLUMNS ( DISTINCT ( 'DimProduct'[Color] ), "Type", "Color" ),
"Name", [Color],
"Type", [Type]
)
RETURN
UNION ( customer, product1 )dynamic =
VAR RS_Color =
TREATAS ( VALUES ( 'Calculated_tale_Utils_'[Name] ), DimProduct[Color] )
VAR M_Color =
CALCULATE ( [Amount_filter], RS_Color )
VAR RS_Occupation =
TREATAS ( VALUES ( 'Calculated_tale_Utils_'[Name] ), DimCustomer[EnglishOccupation] )
VAR M_Occupation =
CALCULATE ( [Amount_filter], RS_Occupation )
RETURN
SWITCH (
TRUE (),
SELECTEDVALUE ( 'Calculated_tale_Utils_'[Type] ) = "Color", M_Color,
SELECTEDVALUE ( 'Calculated_tale_Utils_'[Type] ) = "Profession", M_Occupation,
M_Color
)
If the problem is still not resolved, please provide detailed error information and test data. Looking forward to your reply.
Best Regards,
Henry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@henry24007 , Same table will not so that. I have done it for month, just change logic to year. You can do with year tables in place of date tables
Select data between months - https://youtu.be/nEt7dT3Tfv4
but I found that measure can't be put in the bar chart X-axis, how to solve that?
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 |
|---|---|
| 97 | |
| 73 | |
| 50 | |
| 46 | |
| 44 |