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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
Bebecirux
Frequent Visitor

replace value 0, with if isblank in measure with DAX

hello how are you all?

I present my problem, I have a measure that returns my last cost value, but sometimes it has not been purchased for a long time and that is why the value gives me empty and I would like if you can help me include the IF ISBLANK formula for solve my problem and put a unique key value "1.01" or another

Thank you so much

 

Captura de pantalla 2023-04-04 160509.jpgCaptura de pantalla 2023-04-04 160727.jpg

 

 

1 ACCEPTED SOLUTION
olgad
Resident Rockstar
Resident Rockstar

No probs,

 

Ultimo Nacionalizado =
VAR UltimaFechaNacionalizado =
    CALCULATE(
        MAX(CostosXProveedor[Fecha]),
        ALL(CostosXProveedor[Nacionalizado])
    )

 

RETURN
    If(isblank(CALCULATE(
        SUM(CostosXProveedor[Nacionalizado]),
        FILTER(CostosXProveedor, CostosXProveedor[Fecha] = UltimaFechaNacionalizado  
    ))), 1.01, 
CALCULATE(
        SUM(CostosXProveedor[Nacionalizado]),
        FILTER(CostosXProveedor, CostosXProveedor[Fecha] = UltimaFechaNacionalizado  
    ))) 
 
 
or you can write
 
Ultimo Nacionalizado =
VAR UltimaFechaNacionalizado =
    CALCULATE(
        MAX(CostosXProveedor[Fecha]),
        ALL(CostosXProveedor[Nacionalizado])
    )

var final=
    CALCULATE(
        SUM(CostosXProveedor[Nacionalizado]),
        FILTER(CostosXProveedor, CostosXProveedor[Fecha] = UltimaFechaNacionalizado  
    ))

Return
if(isblank(final), 1.01, final)
Watch out, depends where you are placing it, which visual. Please try

DID I ANSWER YOUR QUESTION? PLEASE MARK MY POST AS A SOLUTION! APPRECIATE YOUR KUDO/LIKE!
PROUD TO BE A SUPER USER!
Best Stories, Interesting Cases: PowerBI Storytime Newsletter
Linkedin Profile: Linkedin
YouTube Channel: PowerBI Storytime

View solution in original post

6 REPLIES 6
olgad
Resident Rockstar
Resident Rockstar

No probs,

 

Ultimo Nacionalizado =
VAR UltimaFechaNacionalizado =
    CALCULATE(
        MAX(CostosXProveedor[Fecha]),
        ALL(CostosXProveedor[Nacionalizado])
    )

 

RETURN
    If(isblank(CALCULATE(
        SUM(CostosXProveedor[Nacionalizado]),
        FILTER(CostosXProveedor, CostosXProveedor[Fecha] = UltimaFechaNacionalizado  
    ))), 1.01, 
CALCULATE(
        SUM(CostosXProveedor[Nacionalizado]),
        FILTER(CostosXProveedor, CostosXProveedor[Fecha] = UltimaFechaNacionalizado  
    ))) 
 
 
or you can write
 
Ultimo Nacionalizado =
VAR UltimaFechaNacionalizado =
    CALCULATE(
        MAX(CostosXProveedor[Fecha]),
        ALL(CostosXProveedor[Nacionalizado])
    )

var final=
    CALCULATE(
        SUM(CostosXProveedor[Nacionalizado]),
        FILTER(CostosXProveedor, CostosXProveedor[Fecha] = UltimaFechaNacionalizado  
    ))

Return
if(isblank(final), 1.01, final)
Watch out, depends where you are placing it, which visual. Please try

DID I ANSWER YOUR QUESTION? PLEASE MARK MY POST AS A SOLUTION! APPRECIATE YOUR KUDO/LIKE!
PROUD TO BE A SUPER USER!
Best Stories, Interesting Cases: PowerBI Storytime Newsletter
Linkedin Profile: Linkedin
YouTube Channel: PowerBI Storytime

@olgad thank very much 

 

you saved me. thank you very very much

olgad
Resident Rockstar
Resident Rockstar

1) You import this excel that you show and there are already blank values in the table for FOB, right? 

In power query you can right click on FOB and replace the blank values with 1.01 right click replace values -values to replace you shall write nothing leave it blank and with 1.01 

 

2) or when you create your measure calculation you get blank? Show the screenshot of the visual in pbi where you see blank, not excel


DID I ANSWER YOUR QUESTION? PLEASE MARK MY POST AS A SOLUTION! APPRECIATE YOUR KUDO/LIKE!
PROUD TO BE A SUPER USER!
Best Stories, Interesting Cases: PowerBI Storytime Newsletter
Linkedin Profile: Linkedin
YouTube Channel: PowerBI Storytime

@olgad Excuse my ignorance, your formula was fine, what I don't know is how to add it to my formula so that it works
where should I place the IF(ISBLANK in

Ultimo Nacionalizado =
VAR UltimaFechaNacionalizado =
    CALCULATE(
        MAX(CostosXProveedor[Fecha]),
        ALL(CostosXProveedor[Nacionalizado])
    )

RETURN
    CALCULATE(
        SUM(CostosXProveedor[Nacionalizado]),
        FILTER(CostosXProveedor, CostosXProveedor[Fecha] = UltimaFechaNacionalizado  
    ))
 
Thank You




olgad
Resident Rockstar
Resident Rockstar

Hi,

if(isblank(your whole calc after the word return), 1.01, your calc after return)


DID I ANSWER YOUR QUESTION? PLEASE MARK MY POST AS A SOLUTION! APPRECIATE YOUR KUDO/LIKE!
PROUD TO BE A SUPER USER!
Best Stories, Interesting Cases: PowerBI Storytime Newsletter
Linkedin Profile: Linkedin
YouTube Channel: PowerBI Storytime

@olgad 

Thank you very much for your answer

I have a problem I am very new

Could you give me a little more detail because it didn't work out?

thank you

 

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.