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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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