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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

KPI target goal measure takes last date from trend axis.

Hi,

 

I'm having an issue with the kpi visual in Power BI Desktop. I've created 2 measures. One to show me the sum of a value of the last date in the date table and one to show me the sum of the same value but of the first date. My target goal is the first date 'cause i want to measure if the sum is bigger or smaller than the one today. But the problem seems to be that the measure of the first date, takes the last date on the trend axis, so it's always the same value as the other measure. 

 

Can anybody help me? I've been looking for an answer for quite a while now..

 

Thanks in advance!

1 ACCEPTED SOLUTION
v-juanli-msft
Community Support
Community Support

Hi @Anonymous 

I can reproduce your problem as below:

2.png

To reslove this, i create two measures

firstday_modified =
VAR firstday =
    CALCULATE ( FIRSTDATE ( Sheet2[date] ), ALL ( Sheet2[date] ) )
RETURN
    CALCULATE (
        SUM ( Sheet2[active users] ),
        FILTER ( ALL ( Sheet2 ), Sheet2[date] = firstday )
    )

lastday_modified =
VAR lastday =
    CALCULATE ( LASTDATE ( Sheet2[date] ), ALL ( Sheet2[date] ) )
RETURN
    CALCULATE (
        SUM ( Sheet2[active users] ),
        FILTER ( ALL ( Sheet2 ), Sheet2[date] = lastday )
    )

3.png

 

Best Regards
Maggie

 

Community Support Team _ Maggie Li
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

4 REPLIES 4
v-juanli-msft
Community Support
Community Support

Hi @Anonymous 

I can reproduce your problem as below:

2.png

To reslove this, i create two measures

firstday_modified =
VAR firstday =
    CALCULATE ( FIRSTDATE ( Sheet2[date] ), ALL ( Sheet2[date] ) )
RETURN
    CALCULATE (
        SUM ( Sheet2[active users] ),
        FILTER ( ALL ( Sheet2 ), Sheet2[date] = firstday )
    )

lastday_modified =
VAR lastday =
    CALCULATE ( LASTDATE ( Sheet2[date] ), ALL ( Sheet2[date] ) )
RETURN
    CALCULATE (
        SUM ( Sheet2[active users] ),
        FILTER ( ALL ( Sheet2 ), Sheet2[date] = lastday )
    )

3.png

 

Best Regards
Maggie

 

Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Thanks, this worked for me! 

v-juanli-msft
Community Support
Community Support

Hi @Anonymous 

Could you show some example data?

 

 

Best Regards
Maggie

Anonymous
Not applicable

The problem does not lie with the data, i think it's the kpi visual that's the problem. You have to give a date field for the trend parameter, and i think it performs my measure on the last date. Here is my dax code;

 

Active users (last day) First date = CALCULATE(SUM('SSales internal report'[active users (last day)]);FIRSTDATE('SSales internal report'[export date]))
 
The problem i think is, that it takes the first date of the kpi trend date, but this is always the current date, so it always shows the same value as my other measure:
 
Active users (last day) last date = CALCULATE(SUM('SSales internal report'[active users (last day)]);LASTDATE('SSales internal report'[export date]))
 
Do you understand the problem? 
 
The trend value is: 'SSales internal report'[export date]

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors