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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Divous
Helper III
Helper III

Show values based on date and CONTAINSSTRING

Hi community,

 

may I ask you to help me with improving with my DAX formula?

 

I have Table01 like this:

 

customer_id date details info
108.01.2022 color red
109.01.2022 size small
110.01.2022 price100
211.02.2022 color blue
212.02.2022 size big
213.02.2022 price200
314.03.2022 color pink
315.03.2022 size middle
316.03.2022 price300
417.03.2022colororange
418.03.2022sizebig
419.03.2022price400
520.03.2022colorblack
521.03.2022sizebigger
522.03.2022price500

 

My goal was to show only rows according to customer_id where size contain the word "big".

I have independent date table in slicer and this formula:

 

 

Measure = 
VAR SelectDate =
    SELECTEDVALUE ( Dates[Date] )
VAR _id =
    CALCULATETABLE (
        VALUES ( Table01[customer_id] ),
        FILTER (
            ALLSELECTED ( Table01 ),
            Table01[date] = SelectDate
                && CONTAINSSTRING('Table01'[info],"big")
        )
    )
RETURN
    IF (
        SelectDate = BLANK (),
        1,
        COUNTROWS ( INTERSECT ( VALUES ( Table01[customer_id] ), _id ) )
    )

 

 

Then this measure I use as a filter in table. 
Everything working fine:

Divous_0-1645710965128.png

 

But this work only on specific date.

 

Now what improvement I need is to make it work when slicer is set on between. So output will show this:

 

Divous_1-1645711344772.png

 

Can you help me with this, please?

 

Thanks in advance

 

Divous

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Divous ,

 

Here's my solution.

There's no relationship between two tables.

vstephenmsft_0-1646120621258.png

 

Create a measure and add it in to the visual level filters.

Measure =
IF (
    CALCULATE (
        MAX ( 'Table01'[customer_id] ),
        FILTER (
            ALLSELECTED ( 'Table01' ),
            [customer_id] = MAX ( 'Table01'[customer_id] )
                && [date] >= MIN ( 'Date'[Date] )
                && [date] <= MAX ( 'Date'[Date] )
        )
    )
        = MAX ( 'Table01'[customer_id] ),
    1
)

vstephenmsft_1-1646120988980.png

 

 

Best Regards,

Stephen Tao

 

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
Anonymous
Not applicable

Hi @Divous ,

 

Here's my solution.

There's no relationship between two tables.

vstephenmsft_0-1646120621258.png

 

Create a measure and add it in to the visual level filters.

Measure =
IF (
    CALCULATE (
        MAX ( 'Table01'[customer_id] ),
        FILTER (
            ALLSELECTED ( 'Table01' ),
            [customer_id] = MAX ( 'Table01'[customer_id] )
                && [date] >= MIN ( 'Date'[Date] )
                && [date] <= MAX ( 'Date'[Date] )
        )
    )
        = MAX ( 'Table01'[customer_id] ),
    1
)

vstephenmsft_1-1646120988980.png

 

 

Best Regards,

Stephen Tao

 

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

johnt75
Super User
Super User

If you have a relationship from the 'Dates'[Date] column to Table01[date] then the filtering should happen automatically. Just remove the SelectDate section from the filter in your measure and it should be fine

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors