Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago

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

  • 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

    • Anonymous's avatar
      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? 

       

       

       

      • MFelix's avatar
        MFelix
        Super User

        Hi Anonymous,

         

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

         

        Regards,

        MFelix