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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
romovaro
Responsive Resident
Responsive Resident

Replacing Blanks with Zeros in a Matrix - Date filter no data

HI

 

I have seen different solutions to this issue in the forum but it seems none is working for me.

 

I ahve a table showing the number of projects going Live x month and the Productivity owner name

 

romovaro_1-1737536331086.png

 

Num of projects = All projects with Same customer, same country and same Go Live date = 1 project

The formula below and using the Index column checks previous row for this requierements and shows 0 until condition is met, then 1.

 

NumProjects = IF (
    OR ( OR (
        'PV Cel File'[CID]<>
    CALCULATE (
        MAX ('PV Cel File'[CID]),
        FILTER (
            'PV Cel File',
            'PV Cel File'[Índice] = EARLIER ('PV Cel File'[Índice])-1)
    ),
    'PV Cel File'[Country Long Name]<>
    CALCULATE (
        MAX ('PV Cel File'[Country Long Name]),
        FILTER (
            'PV Cel File',
            'PV Cel File'[Índice] = EARLIER ('PV Cel File'[Índice])-1)
    )
    ),
        'PV Cel File'[GLD]<>
        CALCULATE(
            MAX('PV Cel File'[GLD]),
            FILTER(
                'PV Cel File',
            'PV Cel File'[Índice] = EARLIER ('PV Cel File'[Índice])-1)
        )
    )
    ,1
    ,0
    )

 

I can have different projects rows but if same country/Same Date and same customer...al rows will show 0 except one row that will show 1.

romovaro_2-1737536861750.png

 

 

I would like to show 0 when no projects are scheduled in that month instead of blank so my Target and diff formula works.

Any tip?

 

thanks

4 REPLIES 4
Uzi2019
Super User
Super User

Hi @romovaro 

 

You can simply add 0 to your measure or create one measure with +0 at the end.

 

measure= calculate----------

return result +0

 

I hope this might solve your issue!

 

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!
romovaro
Responsive Resident
Responsive Resident

HI @Uzi2019 

 

I also treid this one but nothing:

 

Measure = calculate(SUM('PV Cel File'[NumProjects]))+0
 
I keep getting blanks
 
My Measure = Old formuola for Projects
 
romovaro_0-1737547408748.png

 

bhanu_gautam
Super User
Super User

@romovaro Yoyu can use the IF function to check for blanks and replace them with zeros

 

DAX
NumProjects =
IF (
OR (
OR (
'PV Cel File'[CID] <>
CALCULATE (
MAX ('PV Cel File'[CID]),
FILTER (
'PV Cel File',
'PV Cel File'[Índice] = EARLIER ('PV Cel File'[Índice])-1
)
),
'PV Cel File'[Country Long Name] <>
CALCULATE (
MAX ('PV Cel File'[Country Long Name]),
FILTER (
'PV Cel File',
'PV Cel File'[Índice] = EARLIER ('PV Cel File'[Índice])-1
)
)
),
'PV Cel File'[GLD] <>
CALCULATE (
MAX ('PV Cel File'[GLD]),
FILTER (
'PV Cel File',
'PV Cel File'[Índice] = EARLIER ('PV Cel File'[Índice])-1
)
)
),
1,
0
)

 

you can wrap your NumProjects measure in another IF statement to check for blanks and replace them with zeros:

DAX
NumProjectsWithZero =
IF (
ISBLANK([NumProjects]),
0,
[NumProjects]
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






HI @bhanu_gautam 

 

Thanks for your quick response.

Unfortunately I get the same results and blanks.

 

romovaro_0-1737539064941.png

 

SumProjectsWithZero =
IF (
ISBLANK(SUM('PV Cel File'[NumProjects])),0,SUM('PV Cel File'[NumProjects]))
 
the issue in my case is that blanks are "Non existent". I filter by date and if blank, that means that the table has no data for this month/Product manager...
 
Eerything comes from one table except the target that is located in another table.
 
romovaro_1-1737539329258.png

 

In Excel would be similar to this:

 

romovaro_2-1737539733421.png

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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