Forum Discussion

Mackie's avatar
Mackie
Icon for Helper I rankHelper I
6 years ago
Solved

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]) )
)

 

 

 

 

  • az38's avatar
    az38
    6 years ago

    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

3 Replies

  • az38's avatar
    az38
    Icon for Community Champion rankCommunity 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]) )
    )