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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Sandeep_PBI
Frequent Visitor

Dynamic KPI Targets

I have a dashboard with 1 KPI and 3 filters (Year, Month and Week). is it possible to have a custom target depending on the filters selected by users.

unnamed.png

 

Dynamic Target = IF week selected THEN 100 ELSE if month selected THEN 1000 ELSE if year selected THEN 1000 ELSE if nothing selected THEN 1000

 

If multiple filters are used then the lowest target should be displayed.  If all the 3 selections are used (Example 2016 > Jan > 4) then the lowest target should be used.

 

  1. How can I achieve the dynamic target field (using DAX) based on the filters selected?

  2. Is there a custom visual out there which will let me create a date filter / slicer using a calendar selection like it is possible in SSRS Parameters? or a collapsable tree style .

something like following?

 

Capture.PNGunnamed (1).png

 

 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@Sandeep_PBI

 

To check if a slicer has been selected we use HASONEVALUE function in DAX.

 

Using this you can create a measure named ShowValues  as

 

 IF(  ( HASONEVALUE(Calendar[WeekNum]) && 
      HASONEVALUE(Calendar[MonthName]) &&
      HASONEVALUE(Calendar[Year]) ), 100
      
      IF ( HASONEVALUE(Calendar[WeekNum]) && 
           HASONEVALUE(Calendar[MonthName]) , 100,
           
       IF (  HASONEVALUE(Calendar[WeekNum]) ,100,    
           If ( HASONEVALUE(Calendar[MonthName]) &&
                 HASONEVALUE(Calendar[Year]) , 5000,
                   If ( HASONEVALUE(Calendar[MonthName]) ,5000,
                       If (HASONEVALUE(Calendar[Year]) , 9999, 0) ) )) )) 

 

This is a nested if expression. 

 

As per you sample visual , the above expression will give the same result irrespective of the year, month and weeknumber selected, when you have multiple years.

 

When you have targets for different year by year, by year and month and by year month and weeknum the data model will have to be totally different and the expression to be used will be different.  Hope you understand that.

 

Try it out and if it works accept this as a solution and also give KUDOS.

 

Cheers

 

CheenuSing

 

 

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

@Sandeep_PBI

 

To check if a slicer has been selected we use HASONEVALUE function in DAX.

 

Using this you can create a measure named ShowValues  as

 

 IF(  ( HASONEVALUE(Calendar[WeekNum]) && 
      HASONEVALUE(Calendar[MonthName]) &&
      HASONEVALUE(Calendar[Year]) ), 100
      
      IF ( HASONEVALUE(Calendar[WeekNum]) && 
           HASONEVALUE(Calendar[MonthName]) , 100,
           
       IF (  HASONEVALUE(Calendar[WeekNum]) ,100,    
           If ( HASONEVALUE(Calendar[MonthName]) &&
                 HASONEVALUE(Calendar[Year]) , 5000,
                   If ( HASONEVALUE(Calendar[MonthName]) ,5000,
                       If (HASONEVALUE(Calendar[Year]) , 9999, 0) ) )) )) 

 

This is a nested if expression. 

 

As per you sample visual , the above expression will give the same result irrespective of the year, month and weeknumber selected, when you have multiple years.

 

When you have targets for different year by year, by year and month and by year month and weeknum the data model will have to be totally different and the expression to be used will be different.  Hope you understand that.

 

Try it out and if it works accept this as a solution and also give KUDOS.

 

Cheers

 

CheenuSing

 

 

@Anonymous

 

worked like a charm! thanks for the solution.

Anonymous
Not applicable

@Sandeep_PBI

 

Glad I was of help to you.

 

CheenuSing

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.