Forum Discussion

kilala's avatar
kilala
Resolver I
3 years ago
Solved

Calculation based on different accounting date

Hi I have created 1 measure to calculate YTD amount for 3 division, (1,2,3). However, these 3 division might have different accounting date compared to our normal date. So, in my dimdate, i hvae 4 columns as sample below:

DatekeyDatePeriodKeyDiv1PeriodKeyDiv2PeriodKeyDiv3
202112282021/12/28202201202112202112
202112292021/12/29202201202112202201
202112302021/12/30202201202201202201
202112312021/12/31202201202201202201
202201012022/01/01202201202201202201

 

 

Logically, if I want to calculate YTD amount for any division, I should start adding amount starting from 20220101.

However, that is not the case here. 

In my case, if I want to calculate YTD amount for div1, i need to sum the amount starting from 20211228 until today.

if I want to calculate YTD amount for div2, i need to sum the amount starting from 20211230 until today.

if I want to calculate YTD amount for div3, i need to sum the amount starting from 20211229 until today.

 

How do I do that using measure?

Please help:)

 

Currently I am only connecting datekey from facttable to datekey from dimdate.

  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi kilala,

    I'd like to suggest you add segmentation table with these division and correspond date ranges.

    Then you can map these divisions to your table records and write formula to calculate based on current division.(use current division to search on the segmentation table date range to filter in the formula calculations)

    Dynamic segmentation – DAX Patterns

    Regards,

    Xiaoxin Sheng

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi kilala,

    I'd like to suggest you add segmentation table with these division and correspond date ranges.

    Then you can map these divisions to your table records and write formula to calculate based on current division.(use current division to search on the segmentation table date range to filter in the formula calculations)

    Dynamic segmentation – DAX Patterns

    Regards,

    Xiaoxin Sheng