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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
WillDetzel
New Member

Filter KPI Value Relative to Selected Date

Hey everyone!

I need some help with the following:
I have a table like this:

WillDetzel_0-1723749010506.png

My Visual KPI:

WillDetzel_1-1723749151713.png

 

So, what I want to do is, I want the target on the KPI to show the value on the column "Meta" on my auxiliar table (the first print), based on the selected date. And when there's no selected date, I want it to show the mos recent target (Meta).

However, I can't seem to be able to do this without creating a calendar table with the target, and that's not what I need. I need my measure to dinamically show me these target values based on the selected date between the "Data Inicial" and "Data Final". Please tell me if this is something that's not able to do this way as well, since I know I could do it with only measures, but I actually need to use the auxiliar table, in order to keep a track record of the KPIs.

 

What I already have is something like this (which is based on the same table, but with a date column, transforming it into a calendar table:

NPS Goal = 

VAR DataSelecionada = SELECTEDVALUE('Calendar'[Date])
VAR DataMaisRecente =
    CALCULATE(
        MAX(DM_KPIs[Data]),
        FILTER(
            DM_KPIs,
            DM_KPIs[KPI] = "NPS Brand"
        )
    )
RETURN
IF(
    ISBLANK(DataSelecionada),
    CALCULATE(
        MAX(DM_KPIs[Meta]),
        DM_KPIs[Data] = DataMaisRecente &&
        DM_KPIs[KPI] = "NPS Brand"
    ),
    CALCULATE(
        MAX(DM_KPIs[Meta]),
        FILTER(
            DM_KPIs,
            DM_KPIs[Data] = DataSelecionada &&
            DM_KPIs[KPI] = "NPS Brand"
        )
    )
)

 

EDIT: Forgot to add that I also need to filter the name, in this case being "NPS Brand".

 

Thanks in advance!

 

2 ACCEPTED SOLUTIONS
v-zhengdxu-msft
Community Support
Community Support

Hi @WillDetzel 

 

In my opinion, it is necessary to create a calendar, and this calendar cannot have a relationship with your main table.

This allows you to select the corresponding date in the calendar and use Measure to determine it.

 

 

How to Get Your Question Answered Quickly

Best Regards

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

View solution in original post

Thanks for tour reply!

I actually changed my approach, and talked to my client, we decided to not have such a historic table with the KPIs, and ended up just making a measure with an IF statement that changes the result based on the selected date.

View solution in original post

2 REPLIES 2
v-zhengdxu-msft
Community Support
Community Support

Hi @WillDetzel 

 

In my opinion, it is necessary to create a calendar, and this calendar cannot have a relationship with your main table.

This allows you to select the corresponding date in the calendar and use Measure to determine it.

 

 

How to Get Your Question Answered Quickly

Best Regards

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

Thanks for tour reply!

I actually changed my approach, and talked to my client, we decided to not have such a historic table with the KPIs, and ended up just making a measure with an IF statement that changes the result based on the selected date.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

Find out what's new and trending in the Fabric community.

Top Kudoed Authors