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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
gujralh
Helper I
Helper I

Count condition in place of Total column

Hello All,

 

How I can replace Total column with countif condition (say >36000 for last 8 days) in below matrix visual.

I  tried  by creating other measure for same count if condition and added in visual but it is giving value against every date and that I don't want.  I need just same matrix (1st) with Count if condition instead of total column.

 

gujralh_1-1717320578560.png

 

gujralh_2-1717320896304.png

 

 

1 ACCEPTED SOLUTION
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.

I changed a condition to implement last three days sales amount, but I hope you can change the condition based on your business logic.

 

Jihwan_Kim_1-1717333867536.png

 

 

Jihwan_Kim_0-1717333845290.png

 

 

expected result sales: = 
VAR _lastdate =
    MAXX ( SUMMARIZE ( sales, 'calendar'[Date] ), 'calendar'[Date] )
VAR _lastthreedays =
    FILTER (
        ALL ( 'calendar' ),
        'calendar'[Date] <= _lastdate
            && 'calendar'[Date] >= _lastdate - 2
    )
RETURN
    SWITCH (
        TRUE (),
        ISINSCOPE ( 'calendar'[Date] ), SUM ( sales[sales] ),
        CALCULATE ( SUM ( sales[sales] ), _lastthreedays )
    )

 


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.

View solution in original post

6 REPLIES 6
gujralh
Helper I
Helper I

@Jihwan_Kim 
How we can filter out with item say >5 value on any specific date (say 5/31) which show those rows only with your shared calculation.

Actually when I'm filtering any greater than value than its only putting the blank value in columns. But I need it to show those items rows only when condition meets for selected date, rest all should be hidden.

Hi,

Sorry that it is a little bit difficult for me to understand your question.

Please provide your sample pbix file's link together with how your expected outcome looks like.

It will help for me to understand more clearly.

Thank you.


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 

 

I need the data in this way, like when i filter value on date (say 6/4/2024) with greater than value 36000 then its showing those rows only , this i did in excel.

gujralh_1-1717766246972.png

 

But in power BI, It only replace with blank rows only.[Say matrix 2 from PB]

gujralh_2-1717766773329.png

 

Anonymous
Not applicable

Hi @gujralh ,

I think one of the misconceptions you have is that in Power BI Desktop, whether you select Table view or Matrix view, as long as there is a value for the current row, then it is also not possible to hide certain rows like Excel will.

In other words, if you want to hide the row, it will only be visible in Visual if it does not have any value. The following screenshot is an example you can refer to.

vyilongmsft_2-1718762863654.png

vyilongmsft_0-1718762677202.png

vyilongmsft_1-1718762840129.png

 

 

 

Best Regards

Yilong Zhou

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

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.

I changed a condition to implement last three days sales amount, but I hope you can change the condition based on your business logic.

 

Jihwan_Kim_1-1717333867536.png

 

 

Jihwan_Kim_0-1717333845290.png

 

 

expected result sales: = 
VAR _lastdate =
    MAXX ( SUMMARIZE ( sales, 'calendar'[Date] ), 'calendar'[Date] )
VAR _lastthreedays =
    FILTER (
        ALL ( 'calendar' ),
        'calendar'[Date] <= _lastdate
            && 'calendar'[Date] >= _lastdate - 2
    )
RETURN
    SWITCH (
        TRUE (),
        ISINSCOPE ( 'calendar'[Date] ), SUM ( sales[sales] ),
        CALCULATE ( SUM ( sales[sales] ), _lastthreedays )
    )

 


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.

Thanks @Jihwan_Kim 

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.