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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
AliceFGX
Frequent Visitor

How to Exclude a company from a visual when data is not available every month?

Hello,

I have a powerBI report where I show on the rows the company names and on columns the months, like below. Some companies like company B do not send me the overdues data every month :

 

                     JAN FEB MAR JUN JUL

Company A  10    15    30    20   22

Company B   5      8                    10

 

I have a slicer that allows to show any months since jan 2021, here I selected only JAN to JUL 2023.

I want to have another slicer that alows me to exclude the companies that did not send data on the period shown on the table, and show only the company A and the others but not B.   So if I select only JAN 2023 and FEB 2023, company B should appear as well as A, as I have received the data for these months in 2023.

 

How can I do this? Thanks in advance to this great community!

 

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

Hi @AliceFGX ,

I created a sample pbix file(see the attachment), please check if that is what you want.

Flag = 
VAR _company =
    SELECTEDVALUE ( 'Table'[Company] )
VAR _count =
    CALCULATE (
        DISTINCTCOUNT ( 'Table'[Month] ),
        FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Company] = _company )
    )
VAR _tab =
    SUMMARIZE (
        ALLSELECTED ( 'Table' ),
        'Table'[Company],
        'Table'[Month],
        "@count",
            CALCULATE (
                DISTINCTCOUNT ( 'Table'[Month] ),
                FILTER (
                    ALLSELECTED ( 'Table' ),
                    'Table'[Company] = EARLIER ( 'Table'[Company] )
                )
            )
    )
RETURN
    IF ( _count < MAXX ( _tab, [@count] ), 0, 1 )

vyiruanmsft_0-1691045497957.png

Best Regards

Community Support Team _ Rena
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

2 REPLIES 2
AliceFGX
Frequent Visitor

Thank you!

v-yiruan-msft
Community Support
Community Support

Hi @AliceFGX ,

I created a sample pbix file(see the attachment), please check if that is what you want.

Flag = 
VAR _company =
    SELECTEDVALUE ( 'Table'[Company] )
VAR _count =
    CALCULATE (
        DISTINCTCOUNT ( 'Table'[Month] ),
        FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Company] = _company )
    )
VAR _tab =
    SUMMARIZE (
        ALLSELECTED ( 'Table' ),
        'Table'[Company],
        'Table'[Month],
        "@count",
            CALCULATE (
                DISTINCTCOUNT ( 'Table'[Month] ),
                FILTER (
                    ALLSELECTED ( 'Table' ),
                    'Table'[Company] = EARLIER ( 'Table'[Company] )
                )
            )
    )
RETURN
    IF ( _count < MAXX ( _tab, [@count] ), 0, 1 )

vyiruanmsft_0-1691045497957.png

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.