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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
ThomasWeppler
Impactful Individual
Impactful Individual

Filter and userelationship in same DAX

Hi powerBI community

I want to use a filter and the userelationship function in the same meassure.
I have tried this and it doesn't work:

Rollout =
Var network_ = {19,20,21,22,43,44}
Return
CALCULATE (COUNT ( 'Projects'[id] ),
USERELATIONSHIP(Calender[Date], Projects[Deadline]),
FILTER(Projects, Projects[Projecttype] IN network_),
FILTER(Projects, Projects[C HP-Status] = "HP DONE"))


However no results are shown
I have tried only to use a filter or the userelationship function and that works perfecktly fine
This works:

Rollout =
CALCULATE (COUNT ( 'Projects'[id] ),
USERELATIONSHIP(Calender[Date], Projects[Deadline])

And this also works: 
Rollout =
Var network_ = {19,20,21,22,43,44}
Return
CALCULATE (COUNT ( 'Projects'[id] ),
FILTER(Projects, Projects[Projecttype] IN network_),
FILTER(Projects, Projects[C HP-Status] = "HP DONE"))

 

So I know that the problem is how I combine the filter and the userelationship function.

Any help would be greatly appreciated.

1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@ThomasWeppler it should work, how you are visualizing the data:

 

Rollout =
Var network_ = {19,20,21,22,43,44}
Return
CALCULATE (COUNT ( 'Projects'[id] ),
USERELATIONSHIP(Calender[Date], Projects[Deadline]),
Projects[Projecttype] IN network_,
Projects[C HP-Status] = "HP DONE")

 

Follow us on LinkedIn

 

Learn about conditional formatting at Microsoft Reactor

My latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

9 REPLIES 9
VIPER129MMG
Frequent Visitor

Alguém consegue me ajudar na função abaixo, ao digitar o resultado é branco
 
BACKLOG =
VAR BACKLOG = "VIEW_ORDERS_BACKLOG."

RETURN
CALCULATE([PEDIDOS],
USERELATIONSHIP(dCALENDARIO[DATA],fPEDIDOS[C6_ENTREG]),
FILTER(fPEDIDOS, fPEDIDOS[ORIGEM] IN {BACKLOG}))
MatiasCh_11
New Member

You could resolve with two calculate like this

 

CALCULATE (CALCULATE(COUNT ( 'Projects'[id] ), USERELATIONSHIP(Calender[Date]Projects[Deadline]), (ProjectsProjects[C HP-Status] = "HP DONE"))

v-angzheng-msft
Community Support
Community Support

Hi, @ThomasWeppler 

May I ask if your problem has been solved? Is the above post helpful to you?

If  it does, could you please mark the post which help as Answered? It will help the others in the community find the solution easily if they face the same problem with you. Thank you.

 

 

Best Regards,
Community Support Team _ Zeon Zheng

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

ThomasWeppler
Impactful Individual
Impactful Individual

So in the end I just used the Userelationship and added the filters in the filter colon and made them hidden so they won't distract the end user.
It works which is awesome, but it means that I will have to add the extra filters on each visualization so it is not as elegant a solution as I would have hoped for. But I think it will have to do for now.

parry2k
Super User
Super User

Good luck!



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

parry2k
Super User
Super User

@ThomasWeppler can you share a sample pbix file, remove sensitive information before sharing. 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

I think it will be hard to know if I have removed all the sensative data.
Especially on a forum full of Power BI experts, someone might be able to get some info back I was supposed to deleted. So I don't want to share the pbix file.

parry2k
Super User
Super User

@ThomasWeppler it should work, how you are visualizing the data:

 

Rollout =
Var network_ = {19,20,21,22,43,44}
Return
CALCULATE (COUNT ( 'Projects'[id] ),
USERELATIONSHIP(Calender[Date], Projects[Deadline]),
Projects[Projecttype] IN network_,
Projects[C HP-Status] = "HP DONE")

 

Follow us on LinkedIn

 

Learn about conditional formatting at Microsoft Reactor

My latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

In a grouped bar chart.
In my axis I have year, quarter, month, week and day which allows drill down.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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