Forum Discussion

Decal's avatar
Decal
Icon for Helper I rankHelper I
1 year ago
Solved

Slicer using the wrong date of two dates

Hello all, I have a Access db backend for an HR db that for the purposes of this conversation has two dates:  approved date and filled date.  All positions will have an approved date, but not all ha...
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi Decal ,

    Based on the testing, create the sample table.

    Then, using the following DAX formula.

     

    Avg Time = 
    CALCULATE(
        AVERAGEX(
            'PowerBIPosition',
            DATEDIFF(
                'PowerBIPosition'[Approved Date],
                'PowerBIPosition'[Fill Date],
                DAY
            )
        ),
        FILTER(PowerBIPosition, 
            PowerBIPosition[Fill Date] >= FIRSTDATE(DimDate[Date]) && PowerBIPosition[Fill Date] <= LASTDATE(DimDate[Date]) && NOT(ISBLANK('PowerBIPosition'[Fill Date])) && 'PowerBIPosition'[Fill Status] = "Filled")
    )

     

    Select 2024 year to filter the page. The result is shown below.

    Best Regards,

    Wisdom Wu

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.