Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Preboat
Frequent Visitor

FILTERING PROBLEM

I have my dax code 

TOTAL Amt =
VAR _TDA = CALCULATE(SUM(DE[SUMAMT], DE[STATUS] ="Deed"
VAR _TB = SUM(DE[SUMbill])
VAR _RATE = DIVIDE([TAD], [TAB])
VAR _ADJUTOTALS=[TDA] - CALCULATE['DE[TAD], DE[CODE] = "2")

RETURN
IF (_RATE >0.5, _TDA BLANK())

this works fine filtering at the total level but not at the detail level for example
the code give me the  result below. filtering where amount is > 0.5 at the total level and row figures remain like in case of name ewrr  and mmomm the totals are filtered but not the entire row.

NAME57620113040Total
wdw dnwu490 34   524
ewrr 305463 4  
jkmdm25    3055
mmomm4 2  40 
Total549546390470579
1 ACCEPTED SOLUTION

Hi @Preboat ,
Thanks for sharing the PBIX.

I checked the setup and noticed that the ShowRow logic you had earlier was being used separately, which meant the visual still showed unwanted rows unless filtered explicitly.

 

I’ve modified the calculation items to embed the ShowRow flag logic directly inside them, so that they return BLANK() when the rate is less than or equal to 0.5.

TDA = 
IF( [ShowRow_Flag] = 1, SELECTEDMEASURE(), BLANK() )
TBA = 
IF(
    [ShowRow_Flag] = 1,
    IF(ISINSCOPE(Append1[Category]), BLANK(), SUM(Append1[SUMbill])),
    BLANK()
)
Rate = 
IF(
    [ShowRow_Flag] = 1,
    IF(NOT ISINSCOPE(Append1[Category]), DIVIDE(SELECTEDMEASURE(), SUM(Append1[SUMbill]))),
    BLANK()
)

This way, the matrix automatically hides those rows without needing an additional measure or filter pane configuration.

 

Result:

vveshwaramsft_0-1754983669915.png

 

Attached the pbix file for reference.

Hope this helps. Please reach out for further assistance.

Thank you.

View solution in original post

13 REPLIES 13
v-veshwara-msft
Community Support
Community Support

Hi @Preboat ,
We wanted to kindly follow up regarding your query. If you need any further assistance, please reach out.
Thank you.

v-veshwara-msft
Community Support
Community Support

Hi @Preboat ,

Just checking in to see if you query is resolved and if any responses were helpful.
Otherwise, feel free to reach out for further assistance.

Thank you.

v-veshwara-msft
Community Support
Community Support

Hi @Preboat ,
Thanks for reaching out to Microsoft Fabric Community.
To achieve the expected behavior where rows are hidden if they don't meet the condition and totals are also blanked accordingly, I used the following two DAX expressions:

Measure for the matrix value:

TOTAL Amt Row Filter = 
VAR _TDA = CALCULATE(SUM(DE[SUMAMT]), DE[STATUS] = "Deed", ALLEXCEPT(DE, DE[NAME]))
VAR _TB = CALCULATE(SUM(DE[SUMbill]), ALLEXCEPT(DE, DE[NAME]))
VAR _RATE = DIVIDE(_TDA, _TB, 0)
VAR _Result = IF(ISBLANK(_TDA) || _RATE > 0.5, BLANK(), SUM(DE[SUMAMT]))
RETURN
_Result

 

Supporting measure to filter rows in the visual:

ShowRow = 
VAR _TDA = CALCULATE(SUM(DE[SUMAMT]), DE[STATUS] = "Deed", ALLEXCEPT(DE, DE[NAME]))
VAR _TB = CALCULATE(SUM(DE[SUMbill]), ALLEXCEPT(DE, DE[NAME]))
VAR _RATE = DIVIDE(_TDA, _TB, 0)
RETURN
IF(_RATE <= 0.5, 1, 0)

Then, in the matrix visual, added ShowRow to the filter pane and set it to show only when the value is 1.

With this setup, only rows where the rate condition is met are displayed, and the total is correctly calculated from those rows.

 

Sample data:

vveshwaramsft_0-1753722137800.png

 

Output:

vveshwaramsft_1-1753722156319.png

 

Hope this helps. Please reach out for further assistance.

 

Attached .pbix for reference.

Thnak you.

 

 

 

Hi @v-veshwara-msft 

Thanks for your suggestion. This is how my table looks like currently 👇

Name24730415GrandtotalTotal BillRate
c n ii302344437545.70%
wewdd414011477562.67%
wee410305408917052.35%
nvnn32433328335023.71%
Grandtotal411511613772621349144%

And my code as indicated is giving me blanks at just the total column without removing the individual rows also where the rate is >0.5. I tried your suggestion but it is still not removing those rows. Below is what my result is looking like currently.

Rows "c n ii"  and "nvnn" where the rate is less than 0.5 has the grandtotal blanks but the detail row remains but i want that whole row taken out.

Name24730415GrandtotalTotal BilledRate
c n ii302344 7545.70%
wewdd414011477562.67%
wee410305408917052.35%
nvnn3243332 35023.71%
Grandtotal411511613772621349144%

Thanks

Hi @Preboat ,

Thanks for the update.

Since the issue still persists even after trying the suggested approach, could you please share the .pbix file so we can assist more accurately and effectively.

 

You can upload the file to your OneDrive or Google Drive and share the link here with the necessary access permissions.

Please follow this guide to share sample data or .pbix: How to provide sample data in the Power BI Forum - Microsoft Fabric Community

 

Thank you.

Hi @v-veshwara-msft 

I have used a sample data since the original is connected to the server. Essentially, what i want to achieve is to filter the matrix visual to just show rows where the rate is greater than 0.5.
FILTERING PROBLEM2.pbix
Thanks

Hi @Preboat ,
Thanks for sharing the PBIX.

I checked the setup and noticed that the ShowRow logic you had earlier was being used separately, which meant the visual still showed unwanted rows unless filtered explicitly.

 

I’ve modified the calculation items to embed the ShowRow flag logic directly inside them, so that they return BLANK() when the rate is less than or equal to 0.5.

TDA = 
IF( [ShowRow_Flag] = 1, SELECTEDMEASURE(), BLANK() )
TBA = 
IF(
    [ShowRow_Flag] = 1,
    IF(ISINSCOPE(Append1[Category]), BLANK(), SUM(Append1[SUMbill])),
    BLANK()
)
Rate = 
IF(
    [ShowRow_Flag] = 1,
    IF(NOT ISINSCOPE(Append1[Category]), DIVIDE(SELECTEDMEASURE(), SUM(Append1[SUMbill]))),
    BLANK()
)

This way, the matrix automatically hides those rows without needing an additional measure or filter pane configuration.

 

Result:

vveshwaramsft_0-1754983669915.png

 

Attached the pbix file for reference.

Hope this helps. Please reach out for further assistance.

Thank you.

Hi @Preboat ,
Just wanted to check if the response provided was helpful. If further assistance is needed, please reach out.
Thank you.

danextian
Super User
Super User

Hi @Preboat

 

Your measure is being evaluated for each combination of your column and row headers and at the column total regardless of the row header. Create another measure that returns the total value for all the visible column headers and use that as a visual filter.

Name Total = 
CALCULATE ( SUM ( 'Table'[Value] ), ALLSELECTED ( 'Table'[Column Header] ) )

 

danextian_0-1752816885073.png

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

@danextian thank you for your response. The problem actually is my current code 
TOTAL Amt =
VAR _TDA = CALCULATE(SUM(DE[SUMAMT], DE[STATUS] ="Deed"
VAR _TB = SUM(DE[SUMbill])
VAR _RATE = DIVIDE([TAD], [TAB])
VAR _ADJUTOTALS=[TDA] - CALCULATE['DE[TAD], DE[CODE] = "2")

RETURN
IF (_RATE >0.5, _TDA BLANK())

filters the total with the >0.5 condition which I am ok with.  But I want to enhance the logic such that for the total that is returned as blank, i want the row to also remain blank. I do not want a blank total that is returning figures in the row.
Thank you

Ashish_Mathur
Super User
Super User

Hi,

Share the download link of the PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Greg_Deckler
Community Champion
Community Champion

@Preboat What results are you expecting?



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Hi @Greg_Deckler  i was expecting the whole row to be taken off. In my example table i am expecting the whole row in red to be taken off and not just the total. Currently the total are filtering correctly to >0.5 condition and returnig blank where the >0.5 condition is met. But the figures that makes up the total remain (the row)

NAME57620113040Total
wdw dnwu490 34   524
ewrr 305463 4  
jkmdm25    3055
mmomm4 2  40 
Total549546390470579

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.