Forum Discussion

Auto_queen's avatar
Auto_queen
Icon for Helper I rankHelper I
4 years ago
Solved

Circular dependency workaround for Formula

Hello,    I'm new to Dax and I was wondering if there is a workaround for the circular dependency issue I'm having.    To calculate what a sales person's commission will be for the month, I take ...
  • amitchandak's avatar
    4 years ago

    Auto_queen , You need to calculate

    if other are columns

    This Month's Commission Payable =

    var _date =  eomonth([Date], -1)

    var _value =Sum([YTD Sales Payable]) - Sum([YTD Salary Paid])

    return calculate( if(_value>0, _value,0) , Filter(Table, eomonth(Table[Date],0)  =_date))

     

    in case others are measure

    calculate([YTD Sales Payable]- [YTD Salary Paid], previousmonth('Date'[Date]) ) //use date table

     

     

    as columns

    YTD Commission Paid =

    var _date =  eomonth([Date], -1)

    var _value =Sum([YTD Sales Payable]) - Sum([YTD Salary Paid])

    return calculate( Sum( if(_value>0, _value,0) ), Filter(Table, eomonth(Table[Date],0)  <=_date))

     

  • tamerj1's avatar
    4 years ago

    Hi Auto_queen 
    Please refer to attched sample file. Your actual case might be littele different depending in your real data and data model.