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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
yoav20007
Helper II
Helper II

help with dax calculate column

I need to create calculate column  that add the last day rate if it is empty. I need that all date have rates .

Thanks !!!

 

date                rate      all rates

1/11/17           5

2/11/17           

3/11/17

4/11/17           4

5/11/17          

6/11/17          4.8

 

 

 

 

1 ACCEPTED SOLUTION

Hi @yoav20007,

 

Why don't you do this in the query editor.

 

Insert a custom column with the following syntax: 

All Rates = [Rate]

Rates.png

 

Then right click on the new column header and select fill down final result below:

fina.png

 

Regards,

MFelix

 


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

9 REPLIES 9
Zubair_Muhammad
Community Champion
Community Champion

Hi @yoav20007

 

Try this calculated column

 

=
VAR Daybefore =
    PREVIOUSDAY ( Table1[date] )
RETURN
    IF (
        ISBLANK ( Table1[Rates] ),
        CALCULATE (
            VALUES ( Table1[Rates] ),
            FILTER ( ALL ( Table1 ), Table1[date] = Daybefore )
        ),
        Table1[Rates]
    )

Regards
Zubair

Please try my custom visuals

Thanks @Zubair_Muhammad

But when i have more than 1 day blanks rates it's dosn't work.

I need to repeat the same rate

test2.JPG

Hi @yoav20007

 

Try this

 

=
IF (
    ISBLANK ( Table1[Rates] ),
    CALCULATE (
        LASTNONBLANK ( Table1[Rates], Table1[Rates] ),
        FILTER ( Table1, Table1[date] < EARLIER ( Table1[date] ) )
    ),
    Table1[Rates]
)

Regards
Zubair

Please try my custom visuals

Thanks @Zubair_Muhammad

 

I try .

But it dosn't works. That's the result . the same number for all of them. 

 

test3.JPG

@yoav20007

Hmmm!!!! May be this one

 

=
IF (
    ISBLANK ( Table1[Rates] ),
    CALCULATE (
        LASTNONBLANK ( Table1[Rates], Table1[Rates] ),
        FILTER (
            Table1,
            Table1[date] < EARLIER ( Table1[date] )
                && Table1[date] > MIN ( Table1[date] )
        )
    ),
    Table1[Rates]
)

Regards
Zubair

Please try my custom visuals

Thanks again @Zubair_Muhammad but ...

Almost 🙂 

that's the result. after the first time it dosn't works.

test6.JPG

Hi @yoav20007,

 

Why don't you do this in the query editor.

 

Insert a custom column with the following syntax: 

All Rates = [Rate]

Rates.png

 

Then right click on the new column header and select fill down final result below:

fina.png

 

Regards,

MFelix

 


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



Hi @MFelix Thank you.

 

Because it to simple and i didn't think about that 🙂 

 

yoav20007
Helper II
Helper II

how to replace 0 with earlier value?

test = IF(ISBLANK(sales[rate])=TRUE(),0,sales[rate])

 

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.