Forum Discussion

ljx0648's avatar
ljx0648
Helper III
3 years ago
Solved

Summing assets based on dates from another table

Hi guys,

 

I have two tables already connected in powerbi (using both "date" column in the table)

 

Last date of previous fiscal refers to the last date of the previous fiscal year (New fiscal starts Nov 01 every year)

 

The result I am hoping to get as per below:

 

In summary, I want to get the sum of current asset group by customer and date in the asset table. At the same time, also another column with the sum of asset group by "last date of previous fiscal" from the calendar table as well.

 

The purpose of this exercise is to compare the current asset Nov 2019, Dec 2019, Jan 2020 so on... to the Asset on the last date of the previous fiscal to track growth.

 

Any suggestion would be much appreciated.

 

Thank you

 

 

5 Replies

  • You can have a measure as below:

     

    Asset Last Date of previou fiscal = 
    
    var _selD = SELECTEDVALUE(SumAssets_AssetTable[Date])
    var _val = CALCULATE( Max(SumAssets_CalendarTable[Last Date of Previous Fiscal]), FILTER(SumAssets_CalendarTable, SumAssets_CalendarTable[Date] = _selD))
    var _asset = CALCULATE(sum(SumAssets_AssetTable[Current asset]), SumAssets_AssetTable[Date] = _val)
    
    RETURN if ( HASONEVALUE(SumAssets_AssetTable[Date]), _asset)

     

     

    Say, you have the relationship as below:

     

    Data as

    Output will be as

    To display exactly your needs, you can filter the visual as 

     

    Hope this helps!

    • ljx0648's avatar
      ljx0648
      Helper III

      Thank you for your quick response! I will try to apply this measure after I have access to my data next week.

      Much appreciated!