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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
grggmrtn
Post Patron
Post Patron

AND filter based on ID and date

I need to isolate data for PersonID that have two specific values (in two different rows, of course), per week. PersonID that only have one of the values need to be ignored.

I've created a matrix table to show the data, but that's not a requirement, if anyone knows a better way.

 

I've tried some different solutions, most from this forum, but none of them seem to be working the way I need them to.

Sample data:

PersonID	WeekNr	Service
1			12		A
1			12		B
1			13		A
1			13		B
1			14		A
1			15		A
2			12		A
2			13		B
2			15		A
2			15		B
2			16		A
2			16		B
3			12		B
3			13		B
3			13		A
3			14		B
3			15		A
3			15		B

I need to make a matrix visualisation, that will show PersonID for everyone that has Service A AND B per week, with a value that comes from a different table (price per service), like this:

grggmrtn_1-1598336603734.png

Right now I have the matrix working, but it's showing me everything, as well as for PersonID that only have one of the services etc.

 

Is there any way I can get what I need?

1 ACCEPTED SOLUTION

@grggmrtn 

Maybe this?

Fowmy_0-1598339381971.png

 

Measure = 

VAR A = 
CALCULATE(
    COUNTROWS(VALUES(Data[Service])),
    ALLSELECTED(Data[Service])
)
RETURN

IF(
    A > 1,
    SUM(Data[Value]),
    BLANK()
)

 

________________________

If my answer was helpful, please mark this post as a solution, this will also help others!.

Click on the Thumbs-Up icon if you like this reply 🙂



YouTube
LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

7 REPLIES 7
Fowmy
Super User
Super User

@grggmrtn 

You create a MATRIX in the following layout. I used a column for Value but your measure will go in there:

Fowmy_0-1598337337695.png

________________________

If my answer was helpful, please mark this post as a solution, this will also help others!.

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube
LinkedIn

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Your matrix looks like the one I already have, and you've run into the same problems that I ahve.

Person 1 - you have values listed for Service A for weeks 14 and 15. Since there is no Service B for those weeks, your value shouldn't be displayed.

 

And what would happen if you have a PersonID 4 that only has Service A? They would also show up in that matrix - but that's what I'm trying to avoid.

 

I need to show PersonID that have BOTH, per weeknr

@grggmrtn 

Maybe this?

Fowmy_0-1598339381971.png

 

Measure = 

VAR A = 
CALCULATE(
    COUNTROWS(VALUES(Data[Service])),
    ALLSELECTED(Data[Service])
)
RETURN

IF(
    A > 1,
    SUM(Data[Value]),
    BLANK()
)

 

________________________

If my answer was helpful, please mark this post as a solution, this will also help others!.

Click on the Thumbs-Up icon if you like this reply 🙂



YouTube
LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Thank you @Fowmy - that worked great 🙂

harshnathani
Community Champion
Community Champion

Hi @grggmrtn ,

 

Not very clear.

 

You can try SUMMARIZE (Table,Table[id], Table[Sevice])

 

 

Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

amitchandak
Super User
Super User

@grggmrtn , try a measure like

countx(filter(summarize(Table,table[personID], "_1", calculate(distinctcount(Table[Service]),Table[Service] in {"A","B"})),[_1] =2),[personID])

 

display only personId and Week

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

And.. what am I supposed to do with this measure?

 

Displaying only PersonID and week isn't going to work either, because the value (price per week) is per service - so I need to display the service as well

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors