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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
DieLem
Helper II
Helper II

Calculation Error in Measure

Hi,

 

I have two graphs that look similar but are different.

 

The first shows a target line of registrations with the current YTD registrations as a column below. It was changed to only show the YTD until today and leave the rest of the year blank using this formula: 

 

IncrementTr YTD = if(VALUES('Date'[Date])<=TODAY(),CALCULATE([IncrementTr Total],DATESYTD('Date'[Date],"30/8")),BLANK())

 

ForumQuestion1.PNG

This one works fine.

 

I want to replicate this logic on a second graph. The second has a target revenue line and YTD revenue as the columns.

ForumQuestion2.PNG 

 

However this gives an error when I apply the same logic to the revenue YTD formula:

 

Test = if(VALUES('Date'[Date])<=TODAY(),CALCULATE([Amount Total 18A],DATESYTD('Date'[Date],"30/8")),BLANK())

 

Here the error:

ForumQuestion3.PNG

I would like the revenue column to also be blank after any date from today like in the first graph.

 

A link to the PowerBI file:

 

https://drive.google.com/open?id=154JP-ZQkBhkGAxt8cEHdgyaj7ZQ1ZKdI (Filename: TrackingExample2)

 

Thanks in advance!

1 ACCEPTED SOLUTION
sdjensen
Solution Sage
Solution Sage

Instead of VALUES('Date'[Date]) <= TODAY() you should use MIN('Date'[Date]) <= TODAY()

/sdjensen

View solution in original post

4 REPLIES 4
Ajaykumar28155
New Member

Ajaykumar28155_0-1676009617836.png

Headcount =
CALCULATE(
    DISTINCTCOUNT(Headcount[Person Number]),FILTER(Headcount,Headcount[Termination Date]=Headcount[Headcount Month])
)
+
CALCULATE(
    DISTINCTCOUNT(Headcount[Person Number]),ISBLANK(Headcount[Termination Date])
)

 

sdjensen
Solution Sage
Solution Sage

Instead of VALUES('Date'[Date]) <= TODAY() you should use MIN('Date'[Date]) <= TODAY()

/sdjensen

Thanks so much @sdjensen !

 

Can you explain to me why it would work in one graph but on in the other? Want to understand so I can handle it myself in future.

 

Thanks!

It's because you use the formula in another context which cause VALUES to return more than one date which causes the error.

/sdjensen

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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