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
Sergiy
Resolver II
Resolver II

Conditional formatting on "items with no data"

Hi there,

 

Here are links to the test sample I made:

Total.bbix

Total.xlsx

 

There are two tables: Shops and Sales.

Total_schema.png 

 

 

 

 

 

 

 

 

 

Some of the shops have corresponding records in Sales table, some shops do not.

I need to make a Table visual displaying Sum([Price]) for every shop in Shops table. Shops that don't have sales also have to be displayed.

Category column of Shop table has to be colored by Conditional Formatting. That coloring is my main aim.

I tried some of approaches but all of them are not perfect.

 

1. 

The Table visual displays: Shops[Shop] column, Shop[Category] column (don't summarize option is On), SumMeasure

As you see, in that case Conditional Formatting works incorrect. Not all categories are colored as expected.

 

2.

The Table visual displays: Shops[Shop] column, Shop[Category] column ('First' option is On), SumMeasure

Here all categories are colored as expected, but as a drawback a letter "A" is displayed underneath, which is not good.

 

3.

The Table visual displays: Shops[Shop] column, CategoryMeasure column, SumMeasure

CategoryMeasure = IF(COUNTA(Shops[ShopId])<>1,BLANK(),MIN(Shops[Category])) 

That is the most desirable variant: all categories are colored as expected, there are no letters underneath the visual.

 

To display all shops "Show items with no data" option is set to On for all Table visuals.

 

Now I apply a filter using a slicer and select one of the shops. As you see, second and third variants have letter "A" as a total, which is not good.

So, I am stumped. I'd like the categories to get colored and unwanted totals are not to be present.

 

Could you please advise on what could be done? 

 

Total.png

 

 

3 REPLIES 3
Seward12533
Solution Sage
Solution Sage

@Sergiy for soluiton 3 try using IFHASONEFILTER rather than the IF(COUNTA( test in your blocking measure. 

 

CategoryMeasure = IF(HASONEFILTER(Shops[ShopId]),MIN(Shops[Category])) 

 

snip_20180826234652.png

 

@Seward12533

Thank you for your reply.

I guessed you ment using Shops[Shop], not Shops[ShopId]:

Otherwise the measure won't show anything at all.

 

But even if we change the measure like this:

CategoryMeasure = IF(HASONEFILTER(Shops[Shop]),MIN(Shops[Category])) 

The result will be exactly the same as when I used "COUNTA" function: if one shop is selected we still have a total row

 

Total_1.png

 

 

Sorry didn’t notice that as part of my testing I changed the relationship between the tables from crossfiltwr in BOTh directions to SINGLE.

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.