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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Creating a measure that is filtered by another measure

Hi, and thanks in advance for your help 😄

 

What i'm trying to do with this measure 

 
CY Volume-NoNewLost = CALCULATE([CY Volume];FILTER('Source PriceVolMix';[PY Net Sales]<>0 && [CY Net Sales]<>0))

 

is to exclude from my analysis those products that have no sales or quantity in any given year. To do this i'm using two previously calculated measures as filters: Net Sales from 2018 and 2019 ([PY Net Sales] and [CY Net Sales] respectively), and work fine.

 

The issue is, when I drop this newly calculated measure in a visual it returns nothing. Only an empty box.

 

The data look something like the one below.

 

Thanks again!

 

 

YearProductNet SalesQuantityBrandBU
2018A1000100010RedAlpha
2018A10012000200RedAlpha
2018A1002100100GreenAlpha
2018A1003500020GreenAlpha
2018A1004100001000BlueBeta
2018A1005100050BlueBeta
2019A1000150015RedAlpha
2019A1001800150RedAlpha
2019A100200GreenAlpha
2019A1003750040GreenAlpha
2019A1004101001500BlueBeta
2019A1005750025BlueBeta
2019A1000-100010RedAlpha
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hey there,

 

Without having seen the actual data, experience tells me the issue is that there aren't any rows in your table that fulfill the filter condition. Sintactically, the formula looks correct.

 

Maybe you could try using ISBLANK ( [PY Net Sales] ) instead of checking whether it's equal to 0.

 

Hope this helps.

Alex

View solution in original post

2 REPLIES 2
Mariusz
Community Champion
Community Champion

Hi @Anonymous 

 

You can try something like this.

Measure = 
VAR _allProductYear = ALL( 'Table'[Product], 'Table'[Year] )
VAR _groupProductYear = GROUPBY( _allProductYear, 'Table'[Product], 'Table'[Year] )
VAR _filterProductYear = FILTER( _groupProductYear, CALCULATE( SUM( 'Table'[Quantity] ) ) = 0 )
VAR _filterProduct = CALCULATETABLE( VALUES( 'Table'[Product] ), _filterProductYear )
RETURN 
CALCULATE(
    SUM( 'Table'[Quantity] ),
    EXCEPT(
        VALUES( 'Table'[Product] ),
        _filterProduct
    )
)

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
Mariusz Repczynski



Anonymous
Not applicable

Hey there,

 

Without having seen the actual data, experience tells me the issue is that there aren't any rows in your table that fulfill the filter condition. Sintactically, the formula looks correct.

 

Maybe you could try using ISBLANK ( [PY Net Sales] ) instead of checking whether it's equal to 0.

 

Hope this helps.

Alex

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors