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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

When having no data for that month visual need to show #NA values

I am having card visual for some measure values which are  changing based on month slicer.

 

i am new in DAX

e.g Averageof%ArchivedforBaselineCircle = AVERAGE('Stage FI_CRS_DashboardInput'[PercentageArchived]) i calculated this average value and it is changing based on month selecting user from slicer.

 

Values are coming properly in visual when having data for that KPI no in database for that measure but how to handled if we don't have entry for any month in database and user selecte that month in slicer visuals are populating with #NA values . and i need to apply this all visual which are changing after selecting slicer.

 

what DAX i need to handle please help me here.

 

 

5 REPLIES 5
Greg_Deckler
Super User
Super User

So, this is a bit tricky because a measure cannot return two different data types (number and text in this case). However, you can get around this with a CONCATENATE. Here is an example:

 

Measure 9 = IF(ISBLANK(COUNT(bar[b])),"NA",CONCATENATE(COUNT(bar[b]),""))

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

HI Thanks @Greg_Deckler 

 

when i used measure as you suggested it is working for.

 

Previously i used measure for Trend is = 

 

Trend KPI No 13 = [Baseline Month KPI NO 13]-[COM Baseline Month for KPI NO 13]

 

As per your suggestion for #NA i modified that as below and now using below 

 

Trend KPI No 13 = IF(ISBLANK([Baseline Month KPI NO 13]-[COM Baseline Month for KPI NO 13]),
"#NA",CONCATENATE([Baseline Month KPI NO 13]-[COM Baseline Month for KPI NO 13],""))

 

it is working for me when there is not data for any month it is showing #NA value, but previosuly the same measure when i applied with table visual conditional formatting option is coming but after modifying and using with #NA above one conditional formating option is not coming. please suggested me how to on that conditional formatting with 2nd one as well which i am using with "#NA". if that option come my problem will resolve so please guide me on that.

Anonymous
Not applicable

@v-yuezhe-msft 

 

i using this filed in table visual only and try to conditional formatting on that but that option is not coming.

 

Trend KPI NO 13  this field below is formula for that.

 

Trend KPI No 13 = IF(ISBLANK([Baseline Month KPI NO 13]-[COM Baseline Month for KPI NO 13]),
"#NA",CONCATENATE([Baseline Month KPI NO 13]-[COM Baseline Month for KPI NO 13],""))

when i draged that field in table visual condition formatting is not coming.

 

But when i draged below field with this below formula, conditional formating option is coming for me.

 

Trend KPI No 13 = [Baseline Month KPI NO 13]-[COM Baseline Month for KPI NO 13]

but i want conditional formatting option on above field.  due to confidential part not able to share data or table sorry for that but how to achive that on that conditional formatting on above field. 

 

 

 

 

 

 

@Anonymous,

Please share sample data of your original table, I will create the above fields in the table and test this scenario.

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@Anonymous,

Could you please share the sample data of your table so that we can test? We also need to know which fields you use to create the table visual.

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.