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
Bimo2023
Regular Visitor

Column to return value from another table based on Dates

Hi 

I have one table1 with non consecutive dates and values, I have created a calendar table with consecutive date and would like to add a column on calendar date to show values from Table1

 

I have tried below formula but I get error "FILTER used in True/False..." 

CALCULATE(FIRSTNONBLANK(Readings[Electricity usage],1),
FILTER(ALL(Readings),Readings[Date]>='Calendar'[Date])
&&Readings[Previous Date]<='Calendar'[Date])

 

Bimo2023_1-1686812562144.png

desired output 

 

Bimo2023_0-1686812509670.png

 

Can you please assist ?

 

Thanks 

 

2 REPLIES 2
MohTawfik
Resolver I
Resolver I

Electricity Usage = 
VAR CurrentDate = 'Calendar'[Date]
VAR PreviousDate =
    CALCULATE(
        MAX(Readings[Date]),
        Readings[Date] <= CurrentDate
    )
RETURN
    CALCULATE(
        MAX(Readings[Electricity usage]),
        Readings[Date] = PreviousDate
    )

Try this one

AnastasiaS
Resolver I
Resolver I

Hello @Bimo2023 

 

Could you try please the following formula?

 

output =
    CALCULATE (
        LASTNONBLANK ( Readings[Electricity usage], 1 ),
        FILTER (
            ALL (Readings ),
            Readings[Date] <= EARLIER ('Calendar'[Date] )
        )
    )

 

Regards,

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.