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 September 15. Request your voucher.

Reply
bourne2000
Helper V
Helper V

Filter visual by measure not working

Hi

 

I have a big data which is 3.3 million and coming from AWS Redshift. I connected through direct query

 

In my table I have a column called Merchant ID. I need to calculate distinct count the merchant ID and create a another measure by counting the dictinct count greater than 1.  I created two measures

 

Total Merchants = DISTINCTCOUNT(instore_transactions_la_month[merchant_id])

 

Create another Measure called Flag

 

Flag = IF([Total Merchants] > 1, TRUE, FALSE)
 
Now I drag the Total Merchants into the card and filter the visual by dragging "flag" measure into filter on this visual. However, I am not able to explan the flag measure on the filter visual. I need to filter only "True"
 
bourne2000_0-1636264730386.png

 

 

Measure is not working on this filter on this visual. Can anyone advise what is the issue? Is there something problem with direct query. My data is quite big. 

8 REPLIES 8
Anonymous
Not applicable

Hi  @bourne2000 ,

I created some data:

vyangliumsft_0-1636436144766.png

You may build a slicer Table as below and build a measure to achieve your goal : show different result if you select different options.

1. Use Enter data to create a slice table.

vyangliumsft_1-1636436144767.png

2. Create measure.

Total Merchants =
DISTINCTCOUNT('instore_transactions_la_month'[Merchant ID])
Flag =
IF(
    [Total Merchants]>1,1,0)
Total =
var _table=SUMMARIZE('instore_transactions_la_month',[Group],"1",[Total Merchants],"2",[Flag])
return
IF(SELECTEDVALUE('Table'[option])=TRUE(),SUMX(FILTER(_table,[2]=1),[Total Merchants]),SUMX(FILTER(_table,[2]=0),[Total Merchants])
)

3. Result:

When the slicer is True:

vyangliumsft_2-1636436144769.png

When the slicer is False:

vyangliumsft_3-1636436144771.png

 

Best Regards,

Liu Yang

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

Fowmy
Super User
Super User

@bourne2000 

Modify your 2nd measure as follows and assign it equal to 1

Flag = IF([Total Merchants] > 1, 1 , 0 )

 

 

Fowmy_0-1636296111972.png

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

@Fowmy Thanks. I modified the measure. However, I am not able to change the filter. It is disabled.

 

bourne2000_0-1636313496538.png

 

PaulDBrown
Community Champion
Community Champion

Try using this measure for the value of the card

 

Distinctcount >1 =
VAR TotMerchants =
    DISTINCTCOUNT ( instore_transactions_la_month[merchant_id] )
RETURN
    COUNTROWS ( FILTER ( instore_transactions_la_month, TotMerchants > 1 ) )

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






@PaulDBrown Measure is working. But it gives the entire dataset records which is 3.3 million. It's not filtering.  Thanks for your reply. Kindly advise

Try:

Merchant Ids > 1 =
SUMX (
    ADDCOLUMNS (
        VALUES ( 'instore_transactions_la_month'[merchant_id] ),
        "Ids",
            IF (
                CALCULATE (
                    COUNT ( 'instore_transactions_la_month'[merchant_id] ),
                    ALLEXCEPT (
                        'instore_transactions_la_month',
                        'instore_transactions_la_month'[merchant_id]
                    )
                ) > 1,
                1
            )
    ),
    [Ids]
)




Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






@PaulDBrown Measure is working, however, it shows value 93. Actual value is 269.

Please share some (fake) data to work out the correct measure





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 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.