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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Mackie
Helper I
Helper I

Set blank and set zero properly when drawing line chart

I want to create a line chart which has "date" as X-axis and count of "product_key" as Y-axis.
And blank should be zero. So I create this measure but unfortunately it reports zero when date comes over limit such as 2019/10/1 and 2020/1/1. How can I set BLANK() when date comes over limit? Thank you.

 

date

product_key
2019/11/11
2019/11/12
2019/12/12
2019/10/13
2019/11/13
2019/12/13

 

 

count_product_key = 
IF (
CALCULATE ( COUNT('table'[product_key]) ) = BLANK (),
0,
CALCULATE ( COUNT('table'[product_key]) )
)

 

 

 

 

1 ACCEPTED SOLUTION
az38
Community Champion
Community Champion

@Mackie 

itsnot a DAX question, I think

you could set filter visual count_product_key2 is greater then 0, for example

I m not sure how exactly do you want to see a result, for example for point 2019 December and product_key=1


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

3 REPLIES 3
az38
Community Champion
Community Champion

Hi @Mackie 

COUNT() function should not return BLANK(), it should be a digit like 0

So, try 

count_product_key = 
IF (
CALCULATE ( COUNT('table'[product_key]) ) = 0,
BLANK(),
CALCULATE ( COUNT('table'[product_key]) )
)

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Hi, @az38 .

I tried your measure but it does not report zero properly.

Could you download this Power BI file and open it? I created two charts using my measure and your measure.

 

https://sharpsynappx-my.sharepoint.com/:u:/g/personal/mackie_sharpsynappx_onmicrosoft_com/EW_5zztrky...

 

And the problem I want to solve is shown in this picture. That is to remove the unccesary part. 

 

sample_count_product_key.png 

az38
Community Champion
Community Champion

@Mackie 

itsnot a DAX question, I think

you could set filter visual count_product_key2 is greater then 0, for example

I m not sure how exactly do you want to see a result, for example for point 2019 December and product_key=1


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.