cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Lober01 Visitor
Visitor

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

Accepted Solutions
Highlighted
Gonzalex Frequent Visitor
Frequent Visitor

Re: Creating a measure that is filtered by another measure

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
Highlighted
Gonzalex Frequent Visitor
Frequent Visitor

Re: Creating a measure that is filtered by another measure

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

Super User
Super User

Re: Creating a measure that is filtered by another measure

Hi @Lober01 

 

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



Helpful resources

Announcements
October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Badges

Incoming: New and Improved Badges

Exciting news: We've given our badges an overhaul and added brand news ones.

Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

Analytics in Azure virtual event

Analytics in Azure virtual event

Experience a limitless analytics service built to ingest, prep, manage, and serve data for immediate use in Power BI.

Users Online
Currently online: 434 members 4,411 guests
Please welcome our newest community members: