cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
BenJCross95
Frequent Visitor

Show blanks in matrix as 0 while also keeping filters

All,

 

I am creating a report using the usage metrics data from a selected workspace.  I am creating a matrix to show the number of page views and the days since the page was last viewed as a way to indicate that i can hide unused/barely used pages in a report to de-clutter the environment in the service.

 

I have turned on show items with no data for the SectionName but now i would like to replace the blank in PageViews with a 0 and the blank in Days Since Last Open with 31 if PageViews is blank. The usage metrics data is on a rolling month window hence 31 days. The table i currently have is below.

 

BenJCross95_0-1658389212624.png

 

Doing the usual trick of PageViews + 0 and DaysSinceLastOpen + 31 if the values are blank removes the filter on the ReportName and returns every page from every report in the workspace. Is there a way to add the 0 and 31 but still keep the current filter context on the report name.

 

 

1 ACCEPTED SOLUTION

Thanks for the quick response!

 

Your response helped me to get to the answer, it wouldn't work originally - i blame direct query. I created the following measures (with the measure [Page views] being pre-included in the model;

 

Report Page Views =
VAR CreatedTable =
ADDCOLUMNS(
'Report pages',
"@Views",
[Page views]
)
VAR Result =
sumx(CreatedTable, [@Views])
RETURN
Result

 

Then i created;

Days Since Last Open =
IF(
ISBLANK([Report Page Views]),
blank(),
IF(
[Report Page Views] = 0,
31,
int(TODAY() - max('Report page views'[Date]))
)
)

 

Which resulted in the correct table;

BenJCross95_0-1658392012409.png

 

Thanks for the help!!

View solution in original post

2 REPLIES 2
arichard19
Resolver I
Resolver I

Have you tried creating calculated columns in the original tables yet?

For Example:

Column[Views] = IF( ISBLANK(Table1[PageViews]), 0, Table1[PageViews])

Based on the column you can then sum as following:

Measures[View] = CALCULATE(SUMX(Table1, Table1[Views]))

Thanks for the quick response!

 

Your response helped me to get to the answer, it wouldn't work originally - i blame direct query. I created the following measures (with the measure [Page views] being pre-included in the model;

 

Report Page Views =
VAR CreatedTable =
ADDCOLUMNS(
'Report pages',
"@Views",
[Page views]
)
VAR Result =
sumx(CreatedTable, [@Views])
RETURN
Result

 

Then i created;

Days Since Last Open =
IF(
ISBLANK([Report Page Views]),
blank(),
IF(
[Report Page Views] = 0,
31,
int(TODAY() - max('Report page views'[Date]))
)
)

 

Which resulted in the correct table;

BenJCross95_0-1658392012409.png

 

Thanks for the help!!

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors