Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

calculated column to measure

Hi

I have a table and calculated column in power bi desktop looking like this: 

calculation = CALCULATE(
    AVERAGE(Table[value]),
    ALLEXCEPT(Table,Table[category])
)
 
My intention is to make a line and stack column visual with name on x-axis, sum of value on column y-axis and calculation on line y-axis. Is it possible to use a measure for calculation instead of calculated column?
This is the visual I want to make:

 

Thank you in advance!

  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi Anonymous ,
    Thank you pankajnamekar25 for the helpfu response!

    Yes, you can achieve this using a measure instead of a calculated column. The measure will dynamically calculate the average value per category and adjust based on any filters applied in your report.
    Please use the below DAX :

    CalculationMeasure =
    CALCULATE(
        AVERAGE('Table'[Value]),
        ALLEXCEPT('Table', 'Table'[Category]),
        VALUES('Table'[Category])
    )

    Attaching the pbix and the screenshot for your reference.


    I hope this helps.If so,kindly accept it as a solution.

    Thank you for being a valued member of the Microsoft Fabric Community Forum!


3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,
    Thank you pankajnamekar25 for the helpfu response!

    Yes, you can achieve this using a measure instead of a calculated column. The measure will dynamically calculate the average value per category and adjust based on any filters applied in your report.
    Please use the below DAX :

    CalculationMeasure =
    CALCULATE(
        AVERAGE('Table'[Value]),
        ALLEXCEPT('Table', 'Table'[Category]),
        VALUES('Table'[Category])
    )

    Attaching the pbix and the screenshot for your reference.


    I hope this helps.If so,kindly accept it as a solution.

    Thank you for being a valued member of the Microsoft Fabric Community Forum!


  • Hello Anonymous ,

     

    You can try 

    CalculationMeasure =
    CALCULATE(
    AVERAGE(Table[value]),
    ALLEXCEPT(Table, Table[category])
    )

    same as measure it will work.

     

    Thanks,
    Pankaj

    If this solution helps, please accept it and give a kudos (Like), it would be greatly appreciated.

    • Anonymous's avatar
      Anonymous
      Not applicable

      if I try the same for measure then my visual looks like this: