Forum Discussion

NMDGA's avatar
NMDGA
Frequent Visitor
2 years ago
Solved

Dynamic Measure calculation

Hi team ,  i am learning powerbi dax and i am facing difficulty in designing an approach for this implementation:  i have a table with report date , product, activeflag and amount . When i select a...
  • Anonymous's avatar
    Anonymous
    2 years ago

    lbendlin , thanks for your concern about this case. I tried to create a sample data myself based on the user's requirement and implemented the result. Please check if there is anything that can be improved. Here is my solution:
    Hi  NMDGA ,

    I created some data:

    Here are the steps you can follow:

    When the same columns are used in the slicer and the table visual, then the table visual will change with the values selected by the slicer, and we can create a table of dates with no relationship to work with measure

    1. Create calculated table.

    Date =
    CALENDAR(
        DATE(2024,7,1),
        DATE(2024,10,31))

    2. Create measure.

    Flag =
    var _select=SELECTEDVALUE('Date'[Date])
    return
    IF(
        MAX('Table'[report date])=_select ||
        AND(
            MAX('Table'[report date])<_select,MAX('Table'[activeflag])="Y"),1,0)

    3. Place [Flag]in Filters, set is=1, apply filter.

    4. 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