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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Blank Values on KPI Card

Good morning, 

 

I'm have an issue with DAX in two measures I'm attempting to show on Card w/States. Basically I'm trying to show the number of instagram fans in the current month and prior month. Below are my DAX measures. To me, when values are displayed as BLANK it looks sloppy. So I tried an IF statement and I'm getting either NaN or Inifity value. Any of you DAX Masters have any suggestions on how to solve this issue? 

 

Thanks 

 

CurrentPageFans =
CALCULATE (
    SUM ( 'FBInsightsData'[page_fans] ),
    FILTER (
        'FBInsightsData',
        'FBInsightsData'[MetricDate] = MAX ( 'DateSeries'[menddate] )
    )
)
PriorPageFans =
CALCULATE (
    SUM ( 'FBInsightsData'[page_fans] ),
    FILTER (
        'FBInsightsData',
        'FBInsightsData'[MetricDate] = MIN ( 'DateSeries'[sdate] )
    )
)
5 REPLIES 5
MFelix
Super User
Super User

Hi @Anonymous

 

Just add a + 0 to your measures, should return 0 when value is blank so your formulas will look:

 

CurrentPageFans =
CALCULATE (
    SUM ( 'FBInsightsData'[page_fans] ),
    FILTER (
        'FBInsightsData',
        'FBInsightsData'[MetricDate] = MAX ( 'DateSeries'[menddate] )
    )
) + 0



PriorPageFans =
CALCULATE (
    SUM ( 'FBInsightsData'[page_fans] ),
    FILTER (
        'FBInsightsData',
        'FBInsightsData'[MetricDate] = MIN ( 'DateSeries'[sdate] )
    )
) + 0

Regards,

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Anonymous
Not applicable

Hi @MFelix

 

That worked for the CurrentPageFans measure perfectly. Thank you for that! 

 

However where I'm calculating the prior period it's showing the following. Any thoughts? 

 

KPI Card.PNG

 

 

Hi @Anonymous,

 

The NaN% from where? How are you setting up your information what is the visual you are using.

 

Regards,

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Anonymous
Not applicable

Hello,

 

Sorry for the late response, I'm not sure how I missed it. Thank you for replying and helping! I have a been instructed to show on a KPI visual of sorts the Sum of Fans based on Month Year date. When there is no value I need it to show "na", which I'm able to do just fine. However, I'm using the Card with States by OKViz. I'm showing the variance as percent over target. So obviously when there is a value of na it's trying to convert that to a %, and ends up being NaN%. I'm trying to do some DAX trickery and whenever there is no value for the prior month make it just show "na" and haven't been able to get anywhere.

 

So, in my screenshot I have the layout of the data, and my settings for the visual as well as a filter on a month where there is no value for the prior month which then shows the issue on the visual. Hope this makes sense. 

 

Thanks in advance! 

 

Capture.PNG

 

Hi @Anonymous,

 

Not abble to check how you have the final result in this type of card, not abble to repeat your values.

 

Can you share some sample data?

 

Regards,

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.