Forum Discussion

stevedata's avatar
stevedata
Frequent Visitor
2 years ago
Solved

DAX measure in x axis help needed

Hi all

 

I have 4 measures (product1, product2, product3, product4) that I want to have in a chart.

I am trying to show a chart with the measures in the x axis.

 

Currently I can get to the first screenshot below, with each bar representing a product %. But I want to achieve vice versa – i.e. each bar representing region % and each grouping representing product.

Each measure looks like this:

Product1 =

SWITCH(TRUE(),

    SELECTEDVALUE(AllRegions[Region]) = "GLOBAL"

    , CALCULATE('#Product1'[#Product1responded%], ALL(AllRegions[Region]))

    , '#Product1'[#Product1responded%])

 

I want to get to this:

Can anyone help?

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi stevedata ,

    First of all, many thanks to  for your very quick and effective replies.

    Based on my testing, please try the following methods:

    1.Create the simple table.

    2.Create the multiple measures for the product.

    Product 1 = 
    VAR produc_1 =  CALCULATE(SUM('Table'[Sales]), FILTER('Table', 'Table'[Product ID] = 1))
    var tota_ = SUM('Table'[Sales])
    RETURN
    DIVIDE(produc_1, tota_)

    3.Create the new table for the product measure.

    4.Create the new measure to display product percentage.

    Product group = 
    SWITCH(
        TRUE(),
        SELECTEDVALUE('Product'[Product]) = "Product 1", [Product 1],
        SELECTEDVALUE('Product'[Product]) = "Product 2", [Product 2],
        SELECTEDVALUE('Product'[Product]) = "Product 3", [Product 3],
        SELECTEDVALUE('Product'[Product]) = "Product 4", [Product 4]
    )

    5.Select the Percentage Format for the new measure.

    6.Drag the measure into the Y-axis and drag the Region into the Legend.

    7.The result is shown below.

     

    Best Regards,

    Wisdom Wu

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi stevedata ,

    First of all, many thanks to  for your very quick and effective replies.

    Based on my testing, please try the following methods:

    1.Create the simple table.

    2.Create the multiple measures for the product.

    Product 1 = 
    VAR produc_1 =  CALCULATE(SUM('Table'[Sales]), FILTER('Table', 'Table'[Product ID] = 1))
    var tota_ = SUM('Table'[Sales])
    RETURN
    DIVIDE(produc_1, tota_)

    3.Create the new table for the product measure.

    4.Create the new measure to display product percentage.

    Product group = 
    SWITCH(
        TRUE(),
        SELECTEDVALUE('Product'[Product]) = "Product 1", [Product 1],
        SELECTEDVALUE('Product'[Product]) = "Product 2", [Product 2],
        SELECTEDVALUE('Product'[Product]) = "Product 3", [Product 3],
        SELECTEDVALUE('Product'[Product]) = "Product 4", [Product 4]
    )

    5.Select the Percentage Format for the new measure.

    6.Drag the measure into the Y-axis and drag the Region into the Legend.

    7.The result is shown below.

     

    Best Regards,

    Wisdom Wu

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.