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
EAIR
Regular Visitor

When table is filtered to one row hide grand total

Is there a way to hide grand total on a table if it is filtered to just one row.  In my example below I would like to have Total Distinct Conflicting Courses hidden when the filter on the left produces only one row in the table.  I don't want it to show 53 twice.

 

 

EAIR_0-1674495471089.png

 

Please don't tell me to turn Totals off becuase I want the total if there are more than one row (see example below).

 

EAIR_0-1674495986888.png

 

1 ACCEPTED SOLUTION
v-yueyunzh-msft
Community Support
Community Support

Hi , @EAIR 

According to your description, you do not want to show the total when the matrix visual has only one row.

Here are the steps you can refer to :
(1)This is my test data:

vyueyunzhmsft_0-1674713858636.png

I create a [Sum] measure to test:

Sum Measure = SUM('Table'[value])
vyueyunzhmsft_1-1674713897466.png

 

(2)We can create a measure  like this:

 

Measure = var _t = SUMMARIZE( ALLSELECTED('Table') , 'Table'[Class] , 'Table'[Student] ,"Sum" , [Sum Measure])
var _line_count = COUNTROWS(_t)
return
IF(_line_count=1 && NOT( ISFILTERED('Table'[Class])) , BLANK(),[Sum Measure])

 

(3)Then we can put the measure on the visual and we can meet your need.

vyueyunzhmsft_0-1674714079428.png

 

 

 

If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem.

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

View solution in original post

5 REPLIES 5
v-yueyunzh-msft
Community Support
Community Support

Hi , @EAIR 

According to your description, you do not want to show the total when the matrix visual has only one row.

Here are the steps you can refer to :
(1)This is my test data:

vyueyunzhmsft_0-1674713858636.png

I create a [Sum] measure to test:

Sum Measure = SUM('Table'[value])
vyueyunzhmsft_1-1674713897466.png

 

(2)We can create a measure  like this:

 

Measure = var _t = SUMMARIZE( ALLSELECTED('Table') , 'Table'[Class] , 'Table'[Student] ,"Sum" , [Sum Measure])
var _line_count = COUNTROWS(_t)
return
IF(_line_count=1 && NOT( ISFILTERED('Table'[Class])) , BLANK(),[Sum Measure])

 

(3)Then we can put the measure on the visual and we can meet your need.

vyueyunzhmsft_0-1674714079428.png

 

 

 

If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem.

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

Thank you!  Now, is there a way to remove the word Total but keep it when there is more than one row?  Please don't tell me to turn off total becuase I still want it when there are more than one row in the table.

 

I had to remove ", 'Table'[Student]" from the dax you gave me to get it to work (see my measure belew).

 

Measure = var _t = SUMMARIZE( ALLSELECTED('Conflicting Classes') , 'Conflicting Classes'[CourseSectionTitle] ,"Sum" , [Sum Measure])
var _line_count = COUNTROWS(_t)
return
IF(_line_count=1 && NOT( ISFILTERED('Conflicting Classes'[CourseSectionTitle])) , BLANK(),[Sum Measure])

 

EAIR_0-1674747554377.png

 

Hi, @EAIR 

You want to close total on a line. Based on my tests, I didn't find a way to not show Total based on a certain condition.We can currently only show "total" by returning null values for total, but there is no way to turn off displaying "total" for a row.

 

If you want to make your suggestions and optimizations, you can post your ideas to ideas to help the product get better:
Ideas (powerbi.com)

 

Best Regards,

Aniya Zhang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

amitchandak
Super User
Super User

@EAIR , You can hide, you might have to create a filter like

 

new measure =

Var _cnt = countrows(Summarize(Table, (Table[Course]) , "_1",[Confliting Course total]))

return

if(isfiltered(Table[Course]) , [Confliting Course total] , if(_cnt >1, [Confliting Course total], blank() ) )

Thanks for the help.  I couldn't seem to get the first part of your dax to work.  So I opened a new window imported the data and created the table again.  But this time I left the column names alone.  So the column names are the same names as they are in the data.  Any idea why it doesn't like the column [ConflictingCourseSection]?

 

 

EAIR_0-1674578556262.png

 

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.