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

Filter depending on other values in same column

Hello!

I have a dataset looking like this:

DateIDCategoryValue
01012019|45Quantity439579
01012019|45Leadtime 
01012019|46Quantity32142
01012019|46Leadtime10
01022019|45Quantity35436
01022019|45Leadtime2

 

I only want to count the value on quantity if the leadtime is not blank. 
Do you have any idea how I should filter?

 

 

 

 

Quantity tot of selected = 
CALCULATE(
    SUM(Data[Value]),
    FILTER(ALLSELECTED(Data), Data[Category]="Quantity")
)

 

 

 

 

This is how far I've come. 

Thank you for your help!



1 ACCEPTED SOLUTION
v-xiaotang
Community Support
Community Support

Hi @Anonymous 

use this measure:

Measure = 
var tab =selectcolumns( filter(summarize('Table', 'Table'[Date], 'Table'[ID], "t", calculate(sum('Table'[Value]), 'Table'[Category] = "Leadtime")), [t]<>blank()), "date",'Table'[Date],"id", 'Table'[ID])
return
calculate( sum('Table'[Value]), FILTER(ALL('Table'),'Table'[Category]="Quantity"),INTERSECT(tab, selectcolumns('Table', "date",'Table'[Date],"id", 'Table'[ID])))

result:

vxiaotang_0-1625476521473.png

 

Best Regards,

Community Support Team _ Tang

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

View solution in original post

2 REPLIES 2
v-xiaotang
Community Support
Community Support

Hi @Anonymous 

use this measure:

Measure = 
var tab =selectcolumns( filter(summarize('Table', 'Table'[Date], 'Table'[ID], "t", calculate(sum('Table'[Value]), 'Table'[Category] = "Leadtime")), [t]<>blank()), "date",'Table'[Date],"id", 'Table'[ID])
return
calculate( sum('Table'[Value]), FILTER(ALL('Table'),'Table'[Category]="Quantity"),INTERSECT(tab, selectcolumns('Table', "date",'Table'[Date],"id", 'Table'[ID])))

result:

vxiaotang_0-1625476521473.png

 

Best Regards,

Community Support Team _ Tang

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

ryan_mayu
Super User
Super User

@Anonymous 

you can try this

select quantity column and pivot column in PQ

1.PNG

then create a measure

 

 

CALCULATE(
    SUM(Data[Value]),
    FILTER(Data, leadtime<>"")
)

 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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.