Forum Discussion

salmankhan_hm's avatar
salmankhan_hm
Frequent Visitor
3 years ago
Solved

New column creation

Hi,

I want to create a column called Final_Balance which takes its first value from another column called Balance. The second value for this new column must be the second value of another called Credit added to the previous value of this column and so on.

Your help will be really appreciated. Thanks

 

 

 

 

  • Hi,

    I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.

     

     

    final Balance CC =
    VAR _mindate =
        MIN ( Data[Date] )
    VAR _initialbalance =
        MAXX ( FILTER ( Data, Data[Date] = _mindate ), Data[Balance] )
    VAR _currentdate = Data[Date]
    RETURN
        SUMX (
            FILTER ( Data, Data[Date] <= _currentdate && Data[Date] > 1 ),
            Data[Credit/Debit]
        ) + _initialbalance
    

     

5 Replies

  • Hi,

    I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.

     

     

    final Balance CC =
    VAR _mindate =
        MIN ( Data[Date] )
    VAR _initialbalance =
        MAXX ( FILTER ( Data, Data[Date] = _mindate ), Data[Balance] )
    VAR _currentdate = Data[Date]
    RETURN
        SUMX (
            FILTER ( Data, Data[Date] <= _currentdate && Data[Date] > 1 ),
            Data[Credit/Debit]
        ) + _initialbalance
    

     

    • salmankhan_hm's avatar
      salmankhan_hm
      Frequent Visitor

      Hi Kim,

      Thanks for the help. you did it correctly but when I use the DAX you shared I am not getting the correct values. Please check the below screenshot:

       

      • Jihwan_Kim's avatar
        Jihwan_Kim
        Super User

        Hi,

        Thank you for your message.

        The DAX formula that I created was for creating a new column, not a new measure.