Power Pivot Slicers; Hide Data Items with No Data (Against Specific Measures)


Board Regular
I have a typical Fact Table and a typical Customer Table.

My Measures include Market Share within Country and Market Share Globally... for example; the country market share is calculated as follows;

Total Revenue Last 12 Months:=Calculate(Sum(Analysis[SAVAL]),Analysis[SADATE]>EOMONTH(Today(),-13),Analysis[SADATE]<=EOMONTH(Today(),-1))

Country Revenue Last 12 Months:=IF(Hasonevalue(Analysis[Country]),Calculate(Sum(Analysis[SAVal]),All(Company[Comp_Name]),Analysis[Country]=Values(Analysis[Country]),Analysis[SADATE]>EOMONTH(Today(),-13),Analysis[SADATE]<=EOMONTH(Today(),-1)),BLank())

Percentage of Country Revenue:=IFERROR([Total Revenue Last 12 Months]/[Country Revenue Last 12 Months],BLANK())
The Customer Table has Sales Person Name as one of the fields and Customer Name as another. I've built Slicers in for the sales team to filter by Sales Person and by Customer Name. It would be really nice if filtering by sales person narrowed the other filter (Customer Name) only down to those that have data.

This works perfectly in other sheets all the time. I can see the reason it doesn't work here is because the data against those customers is still present in the pivot table, it might form part of the measure for "Country Sales" and it will certainly form part of the calculation of "Global Sales"... so it won't grey out under these conditions.

I wondered, has anyone else encountered a situation where they need the filter to grey out if there is no data against a specific measure? If so, how did you get round it? Did you find a solution? How can we persuade the Power BI to make sure this is included in the next iteration?




New Member
Country Revenue Last 12 Months:=IF[COLOR=#ff0000](Hasonevalue(Analysis[Country])[/COLOR],Calculate(Sum(Analysis[SAVal]),All(Company[Comp_Name]),[COLOR=#ff0000]Analysis[Country]=Values(Analysis[Country]),[/COLOR]Analysis[SADATE]>EOMONTH(Today(),-13),Analysis[SADATE]<=EOMONTH(Today(),-1)),BLank())

Create more tables. Applying filter context on the table from which you're trying to analyze data will cause problems. I recommend creating a countries table, a sales staff table, as well as a date table.

Also, maybe structure your measures:

Total Revenue Last 12 Months:=Calculate(Sum(Analysis[SAVAL]), Analysis[SADATE]>EOMONTH(Today(),13), Analysis[SADATE]<=EOMONTH(Today(),-1) )
Could be:

Total Revenue:=Sum(Analysis[SAVAL])
TTM Date:=EOMONTH(Today(),-13)
Report Date:=EOMONTH(Today(),-1)
Total Revenue Last 12 Months:=Calculate([Total Revenue],Filter(Analysis,Analysis[SADATE]>[TTM Date]),Filter(Analysis,Analysis[SADATE]<=[Report Date]))

Some videos you may like

This Week's Hot Topics

  • Get External Data (long shot question!)
    This is likely a long shot but I am wondering if it is at all possible for Excel to somehow 'change' the contents of a URL that is being linked to...
  • Importing multiple excel files into one spreadsheet
    Hi, I'm trying to import multiple excel files (with the same format into a single spreadsheet) so that each day's file is listed underneath the...
  • Cell Formatting
    Good Morning, I need to format a few different cells in the following manners: A1 has to always add a colon (:) after whatever is typed in by a...
  • How to copy multiple rows using If
    Hi all, I'm very new to VBA and have written this simple code to copy certain cells if a certain cell within that row contains any data. I need...
  • Workbook_Change stopped working !
    I am working on an app to speed up & automate processing of Credit Cards statements. After data is input from a CSV file, it is presented to the...
  • VBA If statement
    Dear All, I have two dates, where I'd like a message box to pop, if the dates are between this criteria. [CODE] sDate1 = #10/1/2019#...