Forum Discussion
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:
However no results are shown
I have tried only to use a filter or the userelationship function and that works perfecktly fine
This works:
And this also works:
So I know that the problem is how I combine the filter and the userelationship function.
Any help would be greatly appreciated.
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.⚡
9 Replies
- parry2kSuper 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.⚡
- ThomasWepplerImpactful Individual
In a grouped bar chart.
In my axis I have year, quarter, month, week and day which allows drill down.
- parry2kSuper User
ThomasWeppler can you share a sample pbix file, remove sensitive information before sharing.
- ThomasWepplerImpactful Individual
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.
- parry2kSuper User
Good luck!
- MatiasCh_11New Member
You could resolve with two calculate like this
CALCULATE (CALCULATE(COUNT ( 'Projects'[id] ), USERELATIONSHIP(Calender[Date], Projects[Deadline]), (Projects, Projects[C HP-Status] = "HP DONE"))
- ThomasWepplerImpactful 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. - v-angzheng-msftCommunity 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 ZhengIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- VIPER129MMGFrequent VisitorAlguém consegue me ajudar na função abaixo, ao digitar o resultado é brancoBACKLOG =VAR BACKLOG = "VIEW_ORDERS_BACKLOG."RETURNCALCULATE([PEDIDOS],USERELATIONSHIP(dCALENDARIO[DATA],fPEDIDOS[C6_ENTREG]),FILTER(fPEDIDOS, fPEDIDOS[ORIGEM] IN {BACKLOG}))