Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Improve Performance - Measure DAX

Hello,

 

I opted to post this issue here has it can be viewed as a separate one. The original problem is here. (FTE calculation taking into account the working days of each activity and the working days of the selected context)

 

I came up with a measure for FTE calculation but, as my FACTS table has 3,610,402 rows, I guess that is the reason why it is taking too long from a performance perspective. It is apparently working for 1 or 2 activities. But if I put is analysing the whole dataset, it gets too slow.

 

Do you know any way I can improve the performance of this measure?

 

 

 

Total FTEs = 
VAR _FirstDate =
    FIRSTDATE ( 'DateC'[Date] )
VAR _LastDate =
    LASTDATE ( 'DateC'[Date] )

RETURN
    SUMX(FACTS, CALCULATE (
        SUM ( FACTS[Result gross (FTE)] )
            * DIVIDE (
                CALCULATE (
                    SUM ( 'DateC'[WorkingDay] ),
                    DATESBETWEEN ( 'DateC'[Date], MAx(_FirstDate,SUM(FACTS[Start date])), MIN(_LastDate,SUM(FACTS[Finish date]) ))
                ),
                Calculate(
                    SUM ( 'DateC'[WorkingDay] ),
                    DATESBETWEEN ( 'DateC'[Date], _FirstDate, _LastDate )
                ),
                0
            ),
        FACTS[Start date] <= _LastDate,
        FACTS[Finish date] >= _FirstDate
    ))

 

 

 

What would be expected, would be something like this, that works for a small number of activities but not for the whole dataset (I had the time horizon from 2020 to 2024 selected):

  • Measure Total FTEs: in the table, as the context is 2020-2024, it calculates according to the 5 years duration;
  • In the graph, it does the calculation according to the shown period, meaning that:
    • June 2020: 0.0716 FTEs;
    • July 2020: 0.0727 FTEs - takes into account the working days of one of the activities, increasing slighly
    • The other months follow a similar logic.
  • What would also be a nice to have, but not a must have, is to have all the months showing into the X axis. I selected 2020-2024 as a page filter but the graphic shows only until Jan 2024 - the end date of the first activity

 

Thanks a lot!

Pedro