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
nimp_kp
Frequent Visitor

Blank data if one category of sales accounts for 100% of sales in a month

Hi

 

As the title says, I'm trying to create a measure that blanks out all sales data in a month if only one product category has 100% of the sales. Dropbox link with sample file at the bottom.

 

In the below picture, all sales in month 1 is vegetable only, so i want month 1 to not show any data in the chart

nimp_kp_0-1623318457301.png

Month 2 is fine, as there are sales across multiple categories.

nimp_kp_1-1623318587922.png

 

Any help is appreciated.

 

Sample pbix included:

https://www.dropbox.com/s/vsqixjb2q7zy4cd/Sample.pbix?dl=0

1 ACCEPTED SOLUTION
PaulOlding
Solution Sage
Solution Sage

Here's a measure that will check how many categories there are and only return the amount when there's more than 1.

 

Amount measure =
VAR _NumCategories =
CALCULATE(
COUNTROWS(VALUES(Ark1[Category])),
REMOVEFILTERS(Ark1[Category])
)
VAR _Result =
IF (_NumCategories > 1,
SUM(Ark1[Amount]),
BLANK()
)
RETURN
_Result

 

View solution in original post

1 REPLY 1
PaulOlding
Solution Sage
Solution Sage

Here's a measure that will check how many categories there are and only return the amount when there's more than 1.

 

Amount measure =
VAR _NumCategories =
CALCULATE(
COUNTROWS(VALUES(Ark1[Category])),
REMOVEFILTERS(Ark1[Category])
)
VAR _Result =
IF (_NumCategories > 1,
SUM(Ark1[Amount]),
BLANK()
)
RETURN
_Result

 

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.

Top Solution Authors