Forum Discussion

Sachy123's avatar
Sachy123
Helper V
6 years ago
Solved

Get latest Balance

I have a COA table which comes as a result of direct query in the following format.

DateIDCOABalance
1100150
1100260
21003100
2100130
3100280
4100360

 

In the Report, I would like to show all the COA;s with thier latest balances.

 

Latest Balance at DateID 4
COABalance
100130
100280
100360

 

What kind of Relationship shall I setup between the COA table and Date Dimension to show the report as above?

 

edit***

 

so after a lot of tries,, i somehow got it done by adding two measures for each COA as below

 

1001balance = var mindate=[minimum1001date] return CALCULATE(SUM(Data[Balance]),FILTER(all(Data),Data[DateID]=mindate && Data[COA]=1001))
 
minimum1001date = var dateselected=SELECTEDVALUE(Data[DateID]) return Maxx(FILTER(all(Data),Data[COA]=1001 && Data[DateID]<=dateselected),Data[DateID])
 
 
 

 

 

 

 

  • Try like

    LASTNONBLANKVALUE(Table[DateID], max(Table[Balance]))
    Or
    LASTNONBLANKVALUE(Table[DateID], sum(Table[Balance]))

     

    Date Join should be on date ID. You can try using Date[Date] in place of Table[Date ID]

     

15 Replies

  • Try like

    LASTNONBLANKVALUE(Table[DateID], max(Table[Balance]))
    Or
    LASTNONBLANKVALUE(Table[DateID], sum(Table[Balance]))

     

    Date Join should be on date ID. You can try using Date[Date] in place of Table[Date ID]

     

  • Hi,

    Will you be selecting Data ID4 in the filter/slicer or do you want the DAX formula to pick up the last balance of each COA automatically?  Also, do you have actual date entries in the DateID column?  I'd request you to share the actual date format that you have in the DateID column.

    • Sachy123's avatar
      Sachy123
      Helper V

      Hi Ashish_Mathur 

      Yes will be selecting the dateid from the filter. well the date-id is coming via date dimension which has got format dd-mm-yyyy