Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

View all the Fabric Data Days sessions on demand. View schedule

Reply
maurcoll
Helper III
Helper III

Default value in a KPI visual when no slicer selected

Hi 

I need some help please

I have a KPI visual where the value is total sales for the current 12 month period, the target is the total sales for the previous 12 month period. I want to know is it possible to show the sales for a default value when nothing is selected in the slicer for product name. So if nothing is selected it defaults to total sales for Product A but if something is selected then it shows the sales for the selected item. 


This is the measure i am using for current 12 months

VAR maxDate = TODAY() - DAY(TODAY())
VAR minDate = EDATE(TODAY() - DAY(TODAY()), -12)
Return
CALCULATE('Table'[Total Sales],  
'Calendar'[Date] <= maxDate && 'Calendar'[Date] > minDate)

 

2 ACCEPTED SOLUTIONS
ExcelMonke
Super User
Super User

Hello,

You can consider using the function ISFILTERED. So something like:

VAR _ProductA = CALCULATE( [ Your measure ], Table[Product] = "ProductA")

RETURN
IF(
ISFILTERED(Table[Product]),[ Your measure ], _ProductA)


Effectively, you are checking if you are filtering for a product. If you are not filtering, then it will calculate your function for ProductA, else just return your measure. 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

DataNinja777
Super User
Super User

Hi @maurcoll ,

 

You can create your required output by using if statement combined with the isfiltered function in your DAX measures. This allows the measure to check if the slicer has an active selection. If it doesn't, it defaults to "Product A".

You need to apply this logic to both your main value (TTM) and your target (PTTM).

KPI Value (Sales TTM) =
VAR maxDate = TODAY() - DAY(TODAY())
VAR minDate = EDATE(TODAY() - DAY(TODAY()), -12)
VAR SlicerIsFiltered = ISFILTERED('Product'[ProductName])

RETURN
IF(
    SlicerIsFiltered,
    // Slicer is used: Calculate for selection
    CALCULATE(
        [Sales],
        'Calendar'[Date] <= maxDate && 'Calendar'[Date] > minDate
    ),
    // Slicer is empty: Default to "Product A"
    CALCULATE(
        [Sales],
        'Calendar'[Date] <= maxDate && 'Calendar'[Date] > minDate,
        'Product'[ProductName] = "Product A"
    )
)
KPI Target (Sales PTTM) =
VAR current_maxDate = TODAY() - DAY(TODAY())
VAR current_minDate = EDATE(current_maxDate, -12)
VAR prev_maxDate = current_minDate
VAR prev_minDate = EDATE(current_minDate, -12)
VAR SlicerIsFiltered = ISFILTERED('Product'[ProductName])

RETURN
IF(
    SlicerIsFiltered,
    // Slicer is used
    CALCULATE(
        [Sales],
        'Calendar'[Date] <= prev_maxDate && 'Calendar'[Date] > prev_minDate
    ),
    // Slicer is empty: Default to "Product A"
    CALCULATE(
        [Sales],
        'Calendar'[Date] <= prev_maxDate && 'Calendar'[Date] > prev_minDate,
        'Product'[ProductName] = "Product A"
    )
)

You can use these two measures in your KPI visual's "Indicator" and "Target" fields.

 

The resultant output is as shown below:

DataNinja777_1-1763138430990.png

DataNinja777_2-1763138471404.png

 

I have attached an example pbix file for your reference.

 

Best regards,

 

View solution in original post

2 REPLIES 2
DataNinja777
Super User
Super User

Hi @maurcoll ,

 

You can create your required output by using if statement combined with the isfiltered function in your DAX measures. This allows the measure to check if the slicer has an active selection. If it doesn't, it defaults to "Product A".

You need to apply this logic to both your main value (TTM) and your target (PTTM).

KPI Value (Sales TTM) =
VAR maxDate = TODAY() - DAY(TODAY())
VAR minDate = EDATE(TODAY() - DAY(TODAY()), -12)
VAR SlicerIsFiltered = ISFILTERED('Product'[ProductName])

RETURN
IF(
    SlicerIsFiltered,
    // Slicer is used: Calculate for selection
    CALCULATE(
        [Sales],
        'Calendar'[Date] <= maxDate && 'Calendar'[Date] > minDate
    ),
    // Slicer is empty: Default to "Product A"
    CALCULATE(
        [Sales],
        'Calendar'[Date] <= maxDate && 'Calendar'[Date] > minDate,
        'Product'[ProductName] = "Product A"
    )
)
KPI Target (Sales PTTM) =
VAR current_maxDate = TODAY() - DAY(TODAY())
VAR current_minDate = EDATE(current_maxDate, -12)
VAR prev_maxDate = current_minDate
VAR prev_minDate = EDATE(current_minDate, -12)
VAR SlicerIsFiltered = ISFILTERED('Product'[ProductName])

RETURN
IF(
    SlicerIsFiltered,
    // Slicer is used
    CALCULATE(
        [Sales],
        'Calendar'[Date] <= prev_maxDate && 'Calendar'[Date] > prev_minDate
    ),
    // Slicer is empty: Default to "Product A"
    CALCULATE(
        [Sales],
        'Calendar'[Date] <= prev_maxDate && 'Calendar'[Date] > prev_minDate,
        'Product'[ProductName] = "Product A"
    )
)

You can use these two measures in your KPI visual's "Indicator" and "Target" fields.

 

The resultant output is as shown below:

DataNinja777_1-1763138430990.png

DataNinja777_2-1763138471404.png

 

I have attached an example pbix file for your reference.

 

Best regards,

 

ExcelMonke
Super User
Super User

Hello,

You can consider using the function ISFILTERED. So something like:

VAR _ProductA = CALCULATE( [ Your measure ], Table[Product] = "ProductA")

RETURN
IF(
ISFILTERED(Table[Product]),[ Your measure ], _ProductA)


Effectively, you are checking if you are filtering for a product. If you are not filtering, then it will calculate your function for ProductA, else just return your measure. 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors