Forum Discussion

klehar's avatar
klehar
Helper V
5 years ago
Solved

Handling default values when no filter is selected

Hi,

 

I'm confused with selectedvalue dax and not sure if at all it would be useful in my case(below)

These are the 4 tables:

Dim_Year

Dim_Geo (used as filter)

 

 

Fact_CapitalLease

 

Fact_GrossProfit

 

 

 

Model

 

Visualization

 

 

I want 2 things here:

1. When all the filters are selected for Geo, my capital lease shold default to some value "x"

2. When data is not available for a particular year (In my case FY22 : capital lease is missing), I want it to default to some value "y"

 

File Link

  • Hi klehar ,

    Is this what you want to achieve?

    CL =
    IF (
        ISFILTERED ( Dimension_Geo[Geo] ),
        COALESCE ( SUM ( Fact_CapitalLease[Capital Lease] ), "y" ),
        "x"
    )

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

1 Reply

  • ERD's avatar
    ERD
    Community Champion

    Hi klehar ,

    Is this what you want to achieve?

    CL =
    IF (
        ISFILTERED ( Dimension_Geo[Geo] ),
        COALESCE ( SUM ( Fact_CapitalLease[Capital Lease] ), "y" ),
        "x"
    )

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