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
cromero2416
Frequent Visitor

Help with measure if is filtered

Hi all,

 

Taking account the attached pbix scenerio i need help to compose a new measure that complete some requirements:

1)By default alway we have to select a product.If nothing is selected one card have to show "Select a product" and the other have to select the max date of the column "Fecha".

 

2)When the produt is select, the card with the text "Select a product" have to show the max commericalWeek of the table "semanacomercialventa" taking accout the max of the fecha.

 

3)If the "tipoproducto" have more thatn one result as is showed in the image. The card should select the max fecha and also the max Week by default.

cromero2416_0-1664890421066.png

 

4)If is selected any other commercial week of the list of options with data should be selected the week selected and the max date.

 

I hope you can help me, I'm really stucked with this.

 

Here also attached some test i've been performance without any result.

 

ExamplePBI.zip

 

 

 

CommercialWeekSelected = 
IF(
    ISFILTERED('semanacomercialventa'[commericalWeek]),
    CALCULATE(
        MAX('semanacomercialventa'[commericalWeek]),
        FILTER(
            'semanacomercialventa',
            'semanacomercialventa'[Index] = MAX('semanacomercialventa'[Index])
        )
    ),
    
        "Select a product"
    )

 

 

 

 

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

Hi @cromero2416 ,

According to your description, I download your sample and here's my solution.

CommercialWeekSelected =
IF (
    ISFILTERED ( 'Product'[tipoproducto] ),
    MAXX (
        FILTER (
            'ventas',
            'ventas'[fecha]
                = MAXX (
                    FILTER (
                        'ventas',
                        'ventas'[typoventa] = SELECTEDVALUE ( 'Product'[tipoproducto] )
                    ),
                    'ventas'[fecha]
                )
        ),
        'ventas'[commericalWeek]
    ),
    "Select a product"
)

Get the correct result.

Requirement1:

vkalyjmsft_0-1665545094907.png

Requirement2,3:

vkalyjmsft_1-1665545205189.png

Requirement4:

vkalyjmsft_2-1665545226561.png

I attach my sample below for your reference.

 

Best Regards,
Community Support Team _ kalyj

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

6 REPLIES 6
v-yanjiang-msft
Community Support
Community Support

Hi @cromero2416 ,

According to your description, I download your sample and here's my solution.

CommercialWeekSelected =
IF (
    ISFILTERED ( 'Product'[tipoproducto] ),
    MAXX (
        FILTER (
            'ventas',
            'ventas'[fecha]
                = MAXX (
                    FILTER (
                        'ventas',
                        'ventas'[typoventa] = SELECTEDVALUE ( 'Product'[tipoproducto] )
                    ),
                    'ventas'[fecha]
                )
        ),
        'ventas'[commericalWeek]
    ),
    "Select a product"
)

Get the correct result.

Requirement1:

vkalyjmsft_0-1665545094907.png

Requirement2,3:

vkalyjmsft_1-1665545205189.png

Requirement4:

vkalyjmsft_2-1665545226561.png

I attach my sample below for your reference.

 

Best Regards,
Community Support Team _ kalyj

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

cromero2416
Frequent Visitor

Hi,

 

Up.

 

Thanks

@cromero2416 , You might have to use

 

CommercialWeekSelected =
IF(
calculate(ISFILTERED('semanacomercialventa'[commericalWeek]), allselected()) ,
CALCULATE(
MAX('semanacomercialventa'[commericalWeek]),
FILTER(
'semanacomercialventa',
'semanacomercialventa'[Index] = MAX('semanacomercialventa'[Index])
)
),

blank()
)

 

for that message we keep an image behind and try to use conditional background formatting,

 

with #FFFFFF00 , transparent color and #FFFFFF white color

 

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
cromero2416
Frequent Visitor

Hi all,

 

Could someone help with this?

 

Thanks in advance

amitchandak
Super User
Super User

@cromero2416 , Based on what I got , Think I have similar calculation in these two blogs

Latest
https://amitchandak.medium.com/power-bi-get-the-last-latest-value-of-a-category-d0cf2fcf92d0

https://amitchandak.medium.com/power-bi-get-the-sum-of-the-last-latest-value-of-a-category-f1c839ee8...

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

hi @amitchandak 

 

mmm i think no , i don't need to sum anything. Is more related to how the dates and comercial weeks are showed in the card taking account the filters in the report. You have the example attached .

 

Thanks in advance

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.

Top Solution Authors