Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

calculated column changing with slicer changes

Hello! i probably have a really stupid issue. i have a table with a start date, and an end date i want to have a calculated column that populates "ongoing" "to go" "Closed" based on a selected dat...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi Anonymous ,

     

    According to your statement, I think your requirement is to show results which are dynamic being impacted by Slicer.

    As far as I know, Power BI doesn't support us to show dynamic results in calculated columns.

    I suggest you to try measure which should meet your requirement. And you can show results in a visual.

    CalculatedColumn =
    VAR today =
        TODAY () - 1
    VAR selected_date =
        MAX ( Sales_DimDate[DDATE] )
    VAR min_date =
        MIN ( today, selected_date )
    RETURN
        IF (
            min_date > MAX ( Table[DATE_END] ),
            "Closed",
            IF ( min_date < MAX ( Table[DATE_START] ), "To Go", "On going" )
        )

     

    Best Regards,
    Rico Zhou

     

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