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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
soldous
Advocate II
Advocate II

Replace NULL with 0 but only between Min and Max value

Hi all,

 

I have 4 tables:

  • FactInvoice which includes monthly invoicing data
  • DimOrder for all orders which have been invoiced
  • DimMaterial for all materials in the orders
  • DimInvoiceDate which is a date dimension

But there could be months with no invoices. 

Now I have 2 visualizations:

  • Total charges (sum of all invoicing data) per months
  • Total charges per months and material

I need to fill months without data with 0. But the simple 

 

IF(ISNULL([Charges]),0[Charges]))

 

doesn't do what I need because it puts zeros across the whole date dimension. I need to fill the gaps only between first and last invoicing data.

The second problem with this measure is that it' doesn't filter materials in the second visualization and shows all of them from DimMaterial with zeros.

 

Could you please help?

Thanks a lot

2 REPLIES 2
kentyler
Solution Sage
Solution Sage

Could you wrap your IF() with a another IF

IF(ISNULL([Charges]),0[Charges]))

IF(someDate >= FactInovice[start_date] && someDate <=FactInvoice[end_date], IF(ISNULL([charges]),0[Charges]))





Did this post answer your question? Mark it as a solution so others can find it!

Help when you know. Ask when you don't!




Join the conversation at We Talk BI find out more about me at Slow BI


I'm still not able to manage this. I could provide dummy pbix if needed.

I don't know how can I check the date in the first IF....I have MIN(FactInvoice[Date]) and MAX(FactInvoice[Date]) but what I need to compare with those?

 

On the visualisation's x-axes I have DimInvoiceDate[YearNumber] - DimInvoiceDate[MonthNumber] hierarchy and these tables are connected with FactInvoice[Date] (YYYYMM) - DimInvoiceDate[DateKey] (YYYYMM) 

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

Top Solution Authors