Forum Discussion

Mbuhary_AOud's avatar
Mbuhary_AOud
New Member
3 years ago

Refer to a Calculated Measure in Tabular Editor inside a Calculation Item Expression

Hi All,

 

Is there a way to refer to a "Calculated Measure" while we write an expression of a "Calculation Item" in Tabular Editor ?

I am trying to build a calculation where I need a "Specific Text" to filter one of the columns in the Dates Table.

I already built the the required text and stored as a "Calculated Measure" in the Tabular Editor.

Is there a way I can use that as filter argument to another Calculation Item?

 

e.g. In my Calculation Group named "TimeCals"

"Calculated Measure A" refers to "XYZ"

 

I need to use the above as follows:


Calculate(
Selectedmeasure(),
Removefilters(DatesTable),

DatesTable[Column_A]='TimeCalcs'[Calculated Measure A]

5 Replies

  • Hi , Mbuhary_AOud 

    According to your description, do you mean you want to use the measure created in the Power BI Desktop in your calculated group's item?

    I test it in my side , i think you can just use it as the same in Power BI .

    This is the measure in my Power Bi Desktop:

    Measure in Desktop = CALCULATE( MAX('Table'[Value]) , ALL('Table'))
     
    Then i create a calcualted item in Tabular Editor:
    var _measure = [Measure in Desktop]
    return
    selectedmeasure()+_measure
     
    The selectedmeasure() means which the measure you put on the visual value.

     

     

    Then we can put the field on the visual to test , the result is as follows:

     

     

    Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

     

    Best Regards,

    Aniya Zhang

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

     

    • Mbuhary_AOud's avatar
      Mbuhary_AOud
      New Member

      Hi Aniya

      Thank you for your response.

      I have created the Calculated Measure inside Tabular Editor, so it resides in the same Tabular Editor Calculation Group.

      I am looking refer to it in my Calculation Item.

      Have you tried something like that...

      BR,

      Imran

      • v-yueyunzh-msft's avatar
        v-yueyunzh-msft
        Icon for Community Support rankCommunity Support

        Hi , Mbuhary_AOud 

        Thanks for your quick response ! Do you mean you need to use the calculated item in the same calculated group?

        For an example , you want to use the [Type] in the [New Calculation]?
        If this , i think you can not just use it directly . In my understand , the calculated group is used to expnad the dimension for the current measure. And for each item has their own contect filter in this visual and do not affect each other.

        So , we can not just use the 'Calculated Group'[Item] to use it in the other Item.

        If you want to use the other value , i think you need to copy the whole dax code in this item as a parameter using the "VAR" to define it.

         

        The result is as follows:

         

         

        By another , in my understand , we can not also use the other item in the differnt calculated group.

         

         

         

        Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

         

        Best Regards,

        Aniya Zhang

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