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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
aris
Frequent Visitor

Filter per category

Hi !

I have 2 tables, Table A shows part number applicability , Table B shows stock levels.

I want to create a report that shows P/N and q-ty per selected AC type. I tried (snip below) but i get P/N A listed twice (and double q-ty) because it is linked to 2 AC types.

Any help appreciated! 🙂

 

P/NAC type
A737
A787
B737
C 
D787

 

 

P/NQty
A10
B1
C2
D54

aris_0-1639222615516.png

 

1 ACCEPTED SOLUTION

Have updated the demo file. The quanity measure needed to read the p/n currently needed...

 

Quantity = 
CALCULATE(
    SUM ( Stock[Qty] ),
    TREATAS( VALUES(Applicability[P/N]), Stock[P/N] )
)

 

Could have made relationship bidirectional but this is safer.



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

View solution in original post

11 REPLIES 11
bcdobbs
Super User
Super User

Can you mock up the output you actually want in excel?

 

I think the way to go is using CONCATENATEX but want to be sure of the output you need.



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!
aris
Frequent Visitor

hi bcdobbs 

i will create button shape filters for each AC type:

aris_0-1639225048523.png

 

Depending on selected button(s), here is what i expect to see:

 

aris_1-1639225105387.png

 

for single selections its not a problem, its multiple AC types selected that give wrong total q-ties.

thanks 🙂

 

 

Have a go with this demo: Applicability Demo 

bcdobbs_1-1639227475642.png

Rather than dropping the A/C column into the visual use this measure instead (and use P/N from your stock table):

 

Applicable Types = 
VAR Result =
   CONCATENATEX(
        VALUES(Applicability[AC type]),
        Applicability[AC type],
        ", ",
        Applicability[AC type], ASC
    )

RETURN IF ( ISINSCOPE(Stock[P/N]), Result, BLANK() )

 



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

Actually I think I'm doing it the opposite way round to what you want! Will update.



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!
aris
Frequent Visitor

that looks very promising!! not sure if it would be possible for ex. that only selected AC types are shown in the table..  i selected 787 and total q-ty is 67. if non relevant where hidden then it would be perfect 

 

I think my change to the quanity measure mentioned below does what you need.

Hoping latest version has now synced up to cloud! Give it a minute and download a fresh copy from  Applicability Demo 



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

Have updated the demo file. The quanity measure needed to read the p/n currently needed...

 

Quantity = 
CALCULATE(
    SUM ( Stock[Qty] ),
    TREATAS( VALUES(Applicability[P/N]), Stock[P/N] )
)

 

Could have made relationship bidirectional but this is safer.



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!
aris
Frequent Visitor

PERFECT!!! thank you so much bcdobbs! you are genious 🙂 

Enjoyed it! Looked simple to start with but there are some subtle requirements! Thanks.



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

Pondering on your data model.

 

I think it's a legitimate use case of a bidirectional relationship. Especially if you only have those two tables. Would remove the need for the TREATAS. 



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!
aris
Frequent Visitor

hi bcdobbs

yes, birectional is the only available i can chose..

aris_0-1639322069350.png

i havent used the Quantity measure and it adds up correctly.

aris_1-1639322550864.png

 

The next challenge, how could i filter if i want by A/C type that is unique : ex. 787 only.

so in my initial example, by chosing 787 it would normally show only D; A would be excluded as its both 787 and 737.

I think the easiest to solve this is by using filter "does not include" in applicable types  ? 😊

Rgds

Aris

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

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

July Newsletter

Fabric Community Update - July 2024

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

Top Solution Authors