Forum Discussion

mmvohra's avatar
mmvohra
Helper II
6 months ago
Solved

Convert calculated column into measure

I have calculated column which is dependent on a measure. The measure itself is dependent on parameter. Now I want to convert the calculated column into measure form so that when the parameter updates "Repost_Price" also gets updated. Suggest a solution please.

Calculated Column:

VAR CurrentConsolidatedID = 'Work'[ConsolidatedID]

VAR CurrentDate = 'Work'[Date]

VAR CurrentPrice = 'Work'[Price]

 

 

-- Find the latest date before the current one within the same ConsolidatedID

VAR PreviousDate =

    MAXX(

        FILTER(

            'Work',

            'Work'[ConsolidatedID] = CurrentConsolidatedID &&

            'Work'[Date] < CurrentDate &&

            Repost Count ID check>0       ),

        'Work'[Date]

    )

 

-- Get the price at that previous date

VAR PreviousPrice =

    CALCULATE(

        MAX('Work'[Price]),

        FILTER(

            'Work',

            'Work'[ConsolidatedID] = CurrentConsolidatedID &&

            'Work'[Date] = PreviousDate &&

            Repost Count ID check>0      

        )

    )

 

RETURN

IF(

    ISBLANK(PreviousDate),

        0,   -- no previous record → blank

        ABS(CurrentPrice - PreviousPrice)

)

Measure: 

Repost Count ID check =

VAR Threshold = 'Parameter 2'[Parameter Value]

RETURN

 

CALCULATE(

    DISTINCTCOUNT('Work'[id]),

   

    FILTER(

       ALLEXCEPT('Work','Work'[ConsolidatedID]),

        VAR Previous_Date =

            CALCULATE(

                MIN('Work'[Date]),

                ALLEXCEPT('Work', 'Work'[ConsolidatedID])

            )

 

       

 

    VAR Initial_Mileage =

            CALCULATE(

                MIN('Work'[Mileage]),

                ALLEXCEPT('Work', 'Work'[ConsolidatedID]),

                'Work'[Date]= Previous_Date

            )

VAR BaselineID =

    CALCULATE(

        MIN('Work'[id]),

        ALLEXCEPT('Work','Work'[ConsolidatedID]),

        'Work'[Date] = Previous_Date

    )

 

VAR DIF= ABS('Work'[Mileage]-Initial_Mileage)

 

VAR Count_1=CALCULATE(COUNTROWS('Work'), ALLEXCEPT('Work','Work'[ConsolidatedID]))

 

RETURN

   DIF <= Threshold &&

    Count_1 > 1

   

    )  

)

 

  • Thankyou, Ashish_Mathur for your response.

    Hi mmvohra,

    We appreciate your inquiry on the Microsoft Fabric Community Forum.

    As suggested by Ashish_Mathur , we kindly request you to provide sample data that clearly demonstrates your issue or query in a structured format (not as an image) to assist us in understanding and resolving the matter. Please ensure that the data is relevant, free from any sensitive information, and directly related to the issue. Additionally, please share the expected outcome based on the provided example.

    Thank you.

4 Replies

  • Thankyou, Ashish_Mathur for your response.

    Hi mmvohra,

    We appreciate your inquiry on the Microsoft Fabric Community Forum.

    As suggested by Ashish_Mathur , we kindly request you to provide sample data that clearly demonstrates your issue or query in a structured format (not as an image) to assist us in understanding and resolving the matter. Please ensure that the data is relevant, free from any sensitive information, and directly related to the issue. Additionally, please share the expected outcome based on the provided example.

    Thank you.

  • Hi mmvohra,

    We are writing to follow up and ask whether the issue has been resolved on your end. If it remains unresolved, please provide sample data that clearly demonstrates the problem or question in a structured (non-image) format so we can better understand and address it. Ensure the data is relevant, does not contain any sensitive information, and directly relates to the issue. Also include the expected outcome based on the provided example.

    If you have any further questions, please feel free to contact the Microsoft Fabric community.

    Thank you.

  • Hi mmvohra,

    We are writing to check whether the issue has been resolved on your end. If it remains unresolved, please share a structured, non-image sample that clearly demonstrates the problem or question. The data should be relevant, free of sensitive information, and directly related to the issue. Also include the expected outcome based on the provided example.

    If you have any further questions, please feel free to reach out to the Microsoft Fabric community.

    Thank you.