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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
BrianNeedsHelp
Resolver I
Resolver I

If any column in Row has 0, True, Else False

All of the Device Names are in one column called DeviceModel.  

I have a table like this where I'm wanting to add one column-'Column Needed' based on if there are any zeros or blanks in each row.    Goal is to be able to filter the one column to True.  Thx!  

Location    Device1    Device2    Device3    Column Needed
A102TRUE
B345FALSE
C033TRUE
D130TRUE

Everything I've tried only calculates each column individually.  E.g. 

ContainsZero = var point_sale = SUMX(VALUES('Hierarchy'[Location]) ,[DAX Product Count])
return IF(MINX(CALCULATETABLE(SUMMARIZE('IOH',IOH[DeviceModel]),ALLEXCEPT('Hierarchy','Hierarchy'[Location])),point_sale)=0,"true","false")

 

1 ACCEPTED SOLUTION

Hi @BrianNeedsHelp,

Thank you for the clarification. Because your data uses a long format with a single DeviceModel column containing counts, you'll need to review all devices for each Location. You can use the following calculated column:

Column Needed =
VAR ZeroCheck =
    CALCULATE (
        COUNTROWS (
            FILTER ( IOH, IOH[DeviceCount] = 0 || ISBLANK ( IOH[DeviceCount] ) )
        ),
        ALLEXCEPT ( IOH, IOH[Location] )
    )
RETURN IF ( ZeroCheck > 0, TRUE, FALSE )

vsaisraomsft_0-1756708071529.png

 

Hope this helps.

Thank you.

 

View solution in original post

6 REPLIES 6
techies
Super User
Super User

Hi @BrianNeedsHelp Or in power query editor , pls try custom column

 

if List.Contains({0, null}, List.Min(Record.ToList(Record.SelectFields(_, {"Device1","Device2","Device3"}))))
then true
else false

 

 

 

― Power BI | Microsoft Fabric | PL-300 | DP-600 | Blog: medium.com/@cseprs_54978
v-saisrao-msft
Community Support
Community Support

Hi @BrianNeedsHelp,

Thank you @Jihwan_Kim, for your insights.

I was able to replicate your issue with the sample data you provided. Here is the output I obtained after adding a calculated column, and I’ve attached the PBIX file for you to review.

Column Needed = 
IF (
    ( 'Table'[Device1] = 0 || ISBLANK ( 'Table'[Device1] ) )
    || ( 'Table'[Device2] = 0 || ISBLANK ( 'Table'[Device2] ) )
    || ( 'Table'[Device3] = 0 || ISBLANK ( 'Table'[Device3] ) ),
    TRUE (),
    FALSE ()
)

vsaisraomsft_0-1756458511331.png

Hope this helps

Thank you.

 

 

Hi @v-saisrao-msft  There is no [Device 1], [Device 2] etc.  There is only one column that has all of the devices-called DeviceModel.  So to get the devices to show up in columns I had to do a Matrix.   I tried using like this and it puts false in all of the rows, and it puts them in the Location field. 

ColChecker = 
IF (
    ( 'IOH'[DeviceCount] = 0 || ISBLANK ( IOH[DeviceCount] ) ),

    TRUE (),
    FALSE ()
)

Hi @BrianNeedsHelp,

Thank you for the clarification. Because your data uses a long format with a single DeviceModel column containing counts, you'll need to review all devices for each Location. You can use the following calculated column:

Column Needed =
VAR ZeroCheck =
    CALCULATE (
        COUNTROWS (
            FILTER ( IOH, IOH[DeviceCount] = 0 || ISBLANK ( IOH[DeviceCount] ) )
        ),
        ALLEXCEPT ( IOH, IOH[Location] )
    )
RETURN IF ( ZeroCheck > 0, TRUE, FALSE )

vsaisraomsft_0-1756708071529.png

 

Hope this helps.

Thank you.

 

Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your semantic model looks like, but I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file.

I tried to not create calculated column, but I tried to create calculated measures, and then I inserted into the visual level filter pane to filter the visualization. 

 

Jihwan_Kim_1-1756436598030.png

 

 

Jihwan_Kim_0-1756436557595.png

 

 

DAX Product Count: = 
VAR _result =
    SUM ( IOH[ProductCount] )
VAR _t =
    ADDCOLUMNS (
        FILTER (
            ALL ( DeviceModel[DeviceModel], DeviceModel[Sort] ),
            DeviceModel[DeviceModel] <> "Needed"
        ),
        "@result", CALCULATE ( SUM ( IOH[ProductCount] ) )
    )
RETURN
    SWITCH (
        SELECTEDVALUE ( DeviceModel[DeviceModel] ),
        "Needed", PRODUCTX ( _t, [@result] ) = 0,
        _result
    )

 

Visual_Filter: = 
VAR _t =
    ADDCOLUMNS (
        FILTER (
            ALL ( DeviceModel[DeviceModel], DeviceModel[Sort] ),
            DeviceModel[DeviceModel] <> "Needed"
        ),
        "@result", CALCULATE ( SUM ( IOH[ProductCount] ) )
    )
RETURN
IF(PRODUCTX(_t, [@result]) = 0,1)

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Hi @Jihwan_Kim .  The tables I have are just Hierarchy and IOH.  I don't have the DeviceModel table, which has Sort.  My model looks like yours except for the DeviceModel table.   Do I need another table to make it work?  

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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