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
Del235
Helper II
Helper II

Measure that shows dates thru yesterday

Today is 9/20/2023.  I'd like to create a measure that would show All dates thru yesterday.  I.E. 1/1, 1/2 ... 9/18, 9/19.  It would always reference what today is and show all dates thru yesterday.

 

Thanks.

10 REPLIES 10
Del235
Helper II
Helper II

My apologies... Table with all dates in this year up to yesterday.

Hi @Del235 your cal. table could be

Test =
VAR __curent_year = YEAR(TODAY())
VAR __yesterday = TODAY()
RETURN
    FILTER(
        'Date',
        YEAR('Date'[Date]) = __curent_year &&
        'Date'[Date]< __yesterday
    )
 

Did I answer your question? Kudos appreciated / accept solution!





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

Proud to be a Super User!






I will check

I get the following error:

Feedback Type:
Frown (Error)

Error Message:
'approx_count_distinct' supports only field access.

 

Hi @Del235 there is no measure in my proposed solution so please check your error.





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

Proud to be a Super User!






Error appears but the table is created as Test.  The table shows every date in 2023 but it doesn't stop at 9/20, which would have been yesterday.  Which field should I be using?

Hi @Del235 try just to rename table which is not Test. If it not works, please share your Date table details.





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

Proud to be a Super User!






I have a Date table.  The formula is now

Test = VAR __curent_year = YEAR ( TODAY ()) VAR __yesterday = TODAY () RETURN     FILTER (         'DateTable',         YEAR ('DateTable'[Date]) = __curent_year &&         'DateTable'[Date]< __yesterday     )  
I get the follow error:
 
The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value.
 

Hi @Del235 I wrote you solution as new calculated table, not column. 

Do you need column in your Date table to mark somehow dates in current year less than yesterday?





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

Proud to be a Super User!






some_bih
Super User
Super User

Hi @Del235 

Measure is usually something which is aggregrable, like sum, min...

When you wrote all the dates up to yesterday, you mean table with all dates in ths year up to yesterday? Or...





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

Proud to be a Super User!






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.