Forum Discussion

grayscg's avatar
grayscg
Icon for Advocate I rankAdvocate I
4 years ago
Solved

Dynamic Axis/Category based on slicer

My question: is it possible to have a dynamically changing axis on a visual?

 

Lets say I have a slicer tied to 'Table1'[MonthBuckets] that has values of 3 Months, 6 Months, 12 months. This is tied to a funnel visual with a "values" option of "Phone Calls" (that always stays the same), and then a "Category" (also called axis in bar charts) option that needs to change between "3 Month Categories", "6 Month Categories", and "12 Month Categories" based on the selected option from the slicer. These three options are all there own column in my data set, not values. 

 

The measure I started working on was:
 
Measure1=
VAR SelectedValue = SELECTEDVALUE('Table1'[MonthBuckets])
RETURN
IF(
SelectedValue = "3 Months", 'Table2'[3 Month Categories],IF(SelectedValue = "6 Months", 'Table2'[6 Month Categories],IF(SelectedValue = "12 Months", 'Table2'[12 Month Categories]))
 
Although this does not work since you can't put Columns into the IF statement in that way. But I feel like it might be on the right track? Any help is appreciated. 
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi grayscg ,

    We can't put the measure on the category/axis field. And if you want to get a calculated column, it will not change according to the user interaction(slicer, filter, column selections etc.) in the report as the value of a calculated column is computed during data refresh and uses the current row as a context... Please review the following links about the difference of calculated column and measure...

    Calculated Columns and Measures in DAX

    Calculated Columns vs Measures

    Best Regards

4 Replies

  • HoangHugo's avatar
    HoangHugo
    Icon for Solution Specialist rankSolution Specialist

    Hi, try this one

    Measure1=
    VAR SelectedValue = SELECTEDVALUE('Table1'[MonthBuckets])
    RETURN
    IF(
    SelectedValue = "3 Months", SELECTEDVALUE('Table2'[3 Month Categories]),IF(SelectedValue = "6 Months", SELECTEDVALUE('Table2'[6 Month Categories]),IF(SelectedValue = "12 Months", SELECTEDVALUE('Table2'[12 Month Categories])))
    • grayscg's avatar
      grayscg
      Icon for Advocate I rankAdvocate I

      This is probably closer but does not allow me to use this measure in a chart. I guess it is just returning text, not the column itself? I am not sure but it does not allow to put the measure in the axis/category portion of a visual

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi grayscg ,

        We can't put the measure on the category/axis field. And if you want to get a calculated column, it will not change according to the user interaction(slicer, filter, column selections etc.) in the report as the value of a calculated column is computed during data refresh and uses the current row as a context... Please review the following links about the difference of calculated column and measure...

        Calculated Columns and Measures in DAX

        Calculated Columns vs Measures

        Best Regards