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

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

Reply
aatish178
Helper IV
Helper IV

dynamic filtering of table visual data based on different dependent conditions

Hi All, I am new to power bi and need your help with below scenario:

I have below data in my table visual:

article noregionretailor novalid dateqty
10East IND1000110/10/2024500
10East IND1000210/10/2024500
10West IND1100110/10/2024400
11South IND2221112/12/2024300
11South IND2221212/12/2024100
11East IND1000110/10/2024600

I want to filter this table visual to show only required row with latest retailor no with below 3 scenario:

In order to show who is the latest retailor among above data, the check 1 is :

Check 1: for each article no, region UNIQUE COMBINATION, find out what is the latest(max) valid date., if found then show that row as a result, if not found then:

Check 2: from the result(filtered data) of Check 1, try to find out what is the latest(max) qty., if found then show that row as result., if not then:

Check 3: from the result(filtered data) of Check 2, try to find out what is the latest(max) retailor no, if found show it as a final result.

 

Let me explain this with example., article no=10, region= East IND

for above article no and region unique combination we have 2 rows, hence first check what is the max of valid date i.e., 10/10/2024.

this date is same for 2 retailors hence next check what is the max of qty., here it is 500 which is again same for 2 rows, hence finally check what is the max of retailor no., here it is 10002., hence show that row alone as a final result.

article noregionretailor novalid dateqty
10East IND1000210/10/2024500


The overall final result from these 3 scenarios would be as shown below:

article noregionretailor novalid dateqty
10East IND1000210/10/2024500
10West IND1100110/10/2024400
11South IND2221112/12/2024300
11East IND1000110/10/2024600


Below is the image FYR:

aatish178_0-1718184377811.png

 

Can someone plz help

 @Ashish_Mathur  @quantumudit  @quantumudit1  @Anonymous   @gmsamborn @Anonymous 

 

Thanks in advance,

Aatish

2 REPLIES 2
Anonymous
Not applicable

Hi @aatish178 ,

 

Please try:

 

Create a calculated column to calculate the latest valid date for each unique combination.

Latest Valid Date = 
CALCULATE(
    MAX('Table'[valid date]),
    ALLEXCEPT('Table','Table'[article no],'Table'[region]))

 

Create a measure to find the maximum quantity.

Latest Qty = 
VAR CurrentArticle = SELECTEDVALUE('Table'[article no])
VAR CurrentRegion = SELECTEDVALUE('Table'[region])
VAR LatestDate = MAX('Table'[valid date])
RETURN
CALCULATE(
    MAX('Table'[qty]),
    FILTER(
        ALL('Table'),
        'Table'[article no] = CurrentArticle && 'Table'[region] = CurrentRegion && 'Table'[valid date] = LatestDate))

 

Create a measure to find the latest retailer ID.

Latest Retailor No = 
VAR CurrentArticle = SELECTEDVALUE('Table'[article no])
VAR CurrentRegion = SELECTEDVALUE('Table'[region])
VAR LatestDate = MAX('Table'[valid date])
VAR LatestQTY = [Latest Qty]
RETURN
CALCULATE(
    MAX('Table'[retailor no]),
    FILTER(
        ALL('Table'),
        'Table'[article no] = CurrentArticle && 'Table'[region] = CurrentRegion && 'Table'[valid date] = LatestDate && 'Table'[qty] = [Latest Qty]
        )
)

 

Create a measure that returns 1 if the set conditions are met, otherwise returns Blank.

Measure = 
VAR _isLtestDay =
    IF ( MAX ( 'Table'[valid date] ) = MAX ( 'Table'[Latest Valid Date] ), 1, BLANK() )
VAR _isMaxQTY =
    IF ( _isLtestDay = 1 && MAX ( 'Table'[qty] ) = 'Table'[Latest Qty], 1, BLANK() )
RETURN
    IF (
        _isMaxQTY = 1
            && MAX ( 'Table'[retailor no] ) = 'Table'[Latest Retailor No],
        1,
        BLANK()
    )

 

In the Filter at the visual object level, set the condition to Not Blank.

vhuijieymsft_0-1718242964737.png

 

The final page effect is as shown below:

vhuijieymsft_1-1718242964743.png

 

If you have any other questions please feel free to contact me.

 

The pbix file is attached.

 

Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

Dear Yang, 

Many thanks for this workaround.

The solution is working as expected. However, I want to show one more small change in the table visual., as shown in below screenshot:

aatish178_0-1718305237018.png

Here I have added one more table with field report interval date .,and used that field as a measure in Qty Calculated measure., my expectation was the final table visual should show valid dates which are less than report interval date., and I am able to achieve that., Now on the top of it I have added valid till date field., and it is showing date as 2025-10-10 and 2025-08-08., 

 

My Requirement is: VALID TILL DATE FIELD SHOULD SHOW BLANK FOR DATES WHICH ARE GREATER THAN REPORT INTERVAL DATE i.e., 2025-10-10 & 2025-08-08 SHOULD BE SHOWN AS BLANK AND THE DATE WHICH IS SMALLER THAN REPORT INTERVAL DATE SHOULD BE SHOWN AS IT IS., IN THIS CASE 2024-08-31 SHOULD BE SHOWN FOR REPORT INTERVAL END DATE. 

Can you please help me with this change.

 

I am unable to attach the updated pbix file here.,

 

Aatish

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.