Forum Discussion

shubh25's avatar
shubh25
Helper I
6 years ago
Solved

Need to calculate this complex function.

I am trying to do a complex formulae using measures. A = Cumulative Amount HC (starting from Year)  B = Current Month exchange Factor C = Cumulative Amount HC (starting from Year upto Last Month...
  • v-diye-msft's avatar
    v-diye-msft
    6 years ago

    Hi shubh25 

     

    Please kindly check below measures whether helps:

    A:

    Amount (HC) = TOTALYTD(SUM(DataSource[Amount (HomeCurrency)]),DatesTable[Date])

    B:

    Please created 1 calculated column in Datasource table, then manage the relationship with Exchange table:

    LastoftheMonth = 
        DATE(
            YEAR(DataSource[Txn Date]),
            MONTH(DataSource[Txn Date])+1,
            1)-1

    Note the directions of filter:

    Then we get the factors:

     

    C:

    Cumulative Amount HC = TOTALYTD(SUM(DataSource[Amount (HomeCurrency)]),DatesTable[Date],ALL(DatesTable[Date]),"6/30")

     ğŸ˜§

    Measure = var a  = MAX('Exchange Rates'[Date])
    var b = DATE(YEAR(a),MONTH(a),1)-1
    Return
    CALCULATE(MAX('Exchange Rates'[Factor]),FILTER(ALL('Exchange Rates'),[Date]=b))

    pbix attached,