Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

DAX Measure based on selected filter value

Hi Everyone!

Just an FYI - I’m very new at using DAX.

 

I’m wanting to build a WIP report for Month end to calculate unrecognised revenue. I’m wanting to create a measure and link a date filter which’ll calculate the unrecognised revenue value as per the selected filter date. The aim is for users to select their desired date.

 

The formula I’d like to achieve:

SUM([Revenue]) WHERE [P&L date] > “[Selected Filtered Date]” + SUM([Revenue]) WHERE [P&L Date] IS NULL.

With the above grouped by Reporting Month.

 

Format of my data:

Reporting MonthP&L DateRevenue
31/01/202331/01/2023100
31/01/202328/02/2023100
31/01/2023NULL150
31/01/202331/03/2023100
28/02/202328/02/2023200
28/02/2023NULL100
28/02/202330/04/2023250
31/03/202331/03/2023150
31/03/202330/04/2023300
31/03/2023NULL100

 

So by having a filter select the date “28/02/23” the measure will calculate the unrecognised revenue as £250 for Reporting Month “31/01/23”

 

Any help/suggestions would be greatly appreciated.

Happy to give more detail if needed

 

Thanks!

  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi  Anonymous ,

     

    Here are the steps you can follow:

    1. Create measure.

    Measure =
    var _select=SELECTEDVALUE('Table'[Reporting Month])
    return
    SUMX(
        FILTER(ALL('Table'),
        'Table'[Reporting Month]<>_select&&'Table'[P&L Date]=BLANK()),[Revenue])

    2. Result:

     

    Best Regards,

    Liu Yang

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

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi  Anonymous ,

     

    Here are the steps you can follow:

    1. Create measure.

    Measure =
    var _select=SELECTEDVALUE('Table'[Reporting Month])
    return
    SUMX(
        FILTER(ALL('Table'),
        'Table'[Reporting Month]<>_select&&'Table'[P&L Date]=BLANK()),[Revenue])

    2. Result:

     

    Best Regards,

    Liu Yang

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