Forum Discussion

ClaireBear's avatar
ClaireBear
Helper I
2 years ago
Solved

Convert Calculated Column into a Measure

Hi,    Is there a way to convert the following calculated column into a measure? Due to the size of the report, a calculated column is throwing out a memory error.  Calculated column: Prev...
  • ClaireBear's avatar
    ClaireBear
    2 years ago

    Hi

     

    I think i found a solution

    I changed the calcuation to read the following:

    Measure_Previous Product Price =
    VAR currDate =
        MAX ( Fact_PO[Doc. Date])
    VAR currSKU =
        SELECTEDVALUE (Fact_PO[Material] )
    VAR currSupplier =
        SELECTEDVALUE (Fact_PO[Name of Vendor] )
    VAR prevDate =
        CALCULATE (
            MAX ( Fact_PO[Doc. Date] ),
            FILTER (
                ALLSELECTED ( Fact_PO ),
                [Doc. Date] < currDate
                    && [Name of Vendor] = currSupplier
                    && [Material] = currSKU
            )
        )
    RETURN
        CALCULATE (
            MIN (Fact_PO[Net Price ZAR] ),
            FILTER (
                ALLSELECTED (Fact_PO ),
                [Doc. Date] = prevDate
                    && [Name of Vendor] = currSupplier
                    && [Material] = currSKU
            )
        )

    I now get the same result:

    Thank you!