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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
joeheng123
Frequent Visitor

PowerBi Table & Measure Issue

Hello im having the same issue again i tried the measure codes numerous times but still unable to change "Or" condition to "And" condition so that my table does not show blank spaces. can anyone assist to provide me the measure code for to copy ?

 

 

 

measure code.PNGProblem 1.PNGsyntax error.PNGsample.PNGsample1.PNG

8 REPLIES 8
Crystal_YW
Helper I
Helper I

Hello:

I think I've solved your issue as follows: only present those who have all grades when are selected in the attributes

please let me know if it works for you

C2.JPGC1.JPGC3.JPG

joeheng123
Frequent Visitor

Hello sorry for the confusion currently i have a problem with my table as shown below the image i do not want to have blank spaces in my "Table". I noticed that my condition has been set to "OR" how can i change it to "AND" condition if possible assist me with the formula / code for me to solve this issue. Expected result is to select multiple subjects and not show any blanks in my table .

 

 

DATA.PNGProblem 1.PNG

Anonymous
Not applicable

 

// T is your table and stores all fields.
// No other tables in the model are
// present. If this is not the case,
// you'll have to adjust the code.

[Name Has All Selected Subjects] =
// Returns 1 if the currently visible name
// does have all the subjects selected,
// and 0 if not.
var __oneNameIsVisible = HASONEFILTER( T[Name] )
var __result =
    if( __oneNameIsVisible,
        var __allSelectedSubjects =
            CALCULATETABLE(
                VALUES( T[Subject] ),
                ALLSELECTED( T )
            )
        var __subjectCount =
            COUNTROWS( __allSelectedSubjects )
        var __nameHasAllSelectedSubjects =
            // When we remove the current
            // filter on Subject and apply
            // __allSelectedSubjects,
            // we should get the same number
            // of subjects as __subjectCount.
            CALCULATE(
                1 * (__subjectCount
                    = DISTINCTCOUNT( T[Subject] )
                ),
                __allSelectedSubjects
            )
        return
            __nameHasAllSelectedSubjects
    )
return
    __result

 

Hello i have tried your code it seems to work but it still does not remove the blanks when i select multiple subjects please refer to image MEASURE CODEMEASURE CODEPROBLEM WITH TABLE SHOWING BLANKSPROBLEM WITH TABLE SHOWING BLANKS

Anonymous
Not applicable

Have you filtered your visual by the measure in the Filters pane? This is where you should use this measure...
amitchandak
Super User
Super User

@joeheng123 ,The information you have provided is not making the problem clear to me. Can you please explain with an example.
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.
Appreciate your Kudos.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

This thing is rather easy to code but you have to do 2 things to get a good answer:

1) Post the model.
2) Show some example data.
3) Tell exactly what you want to achieve.
4) Best to show what the output should be.

 

And it looks like some of the above you have already done 🙂

Pragati11
Super User
Super User

HI @joeheng123 ,

 

Looks like I am not able to understand the whole issue.

 

Both the Screenshots for the measures look exactly same - One without error and one with error.

Can you add details please?

https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.