Forum Discussion
USERELATIONSHIP not working correctly
Hello all,
I have two tables, Calendar and Projecttakken.
There's a main active relationship between Calendar[Date] and Projecttakken[Boekdatum].
There's also an inactive relationship between Calendar[Date] and Projecttakken[Gewijzigd].
For the main part, my visuals are great and work fine.
Except there's one viz in which I need to see all documents from [Gewijzigd] that have status "Vervallen", in the year the slicer shows.
I've used USERELATIONSHIP before with no trouble, so I made this measure:
As I check I expect to see 39 records, but the measure outcome is (Blank).
What am I doing wrong?
17 Replies
- amitchandakSuper User
You measure seems fine. Try following
1) Check any other filter on-page of drilled
2) Create the below measure
Measure1 = CALCULATE(COUNT(Projecttakken[Boeknummer]);USERELATIONSHIP('Calendar'[Date];Projecttakken[Gewijzigd]))
and now a table of matrix drag Statussen[Statuscategorie] and Measure1
Are you able to see the value for Vervallen. If not you can found the issue/
- Ashish_MathurSuper User
Hi,
Does this work?
Measure = CALCULATE(COUNT(Projecttakken[Boeknummer]);Statussen[Statuscategorie]="Vervallen";USERELATIONSHIP(Projecttakken[Gewijzigd];'Calendar'[Date]))
- mrleijzerHelper I
Hey thanks for the quick replies!
Unfortunately they didn't solve the problem.
It's so weird, I've checked all the filters (there's really only one active on the Calendar[Date] field) and it keeps on coming out Blank.
I also tried running the operations in different orders, I've tried the FILTER function but it's no use.
Triple checked the relationships and it all looks good.
I'll keep trying, meanwhile, if you have any brilliant ideas, let me know ;)!
- JarroVGITResident Rockstar
Is it possible to share your PBIX? (only if there is no confidential data in it). If preffered, you could PM me a link if you don't want to share publicly.
- mrleijzerHelper I
Unfortunately, RM&C won't allow me to share this report / data.
- Ashish_MathurSuper User
Hi,
Share the link from where i can download your PBI file. Tell me the exact visual/card where you want to see 39 but are unable to see.
- mrleijzerHelper I
Back to the drawing board...
Measure= CALCULATE(DISTINCTCOUNT(Projecttakken[Boeknummer])works fine, 1073 records, just like I expected.Measure= CALCULATE(DISTINCTCOUNT(Projecttakken[Boeknummer]);Statussen[Statuscategorie]="Vervallen")works fine also, getting and expecting 3 recordsSo when I add USERELATIONSHIPMeasure=CALCULATE(DISTINCTCOUNT(Projecttakken[Boeknummer]);Statussen[Statuscategorie]="Vervallen";USERELATIONSHIP('Calendar'[Date];Projecttakken[Gewijzigd]))It's blank again, so there must be a relationship problem, but where?- v-lid-msftCommunity Support
Hi mrleijzer ,
We can try to use the following measure to meet your requirement:
Measure = CALCULATE ( COUNT ( Projecttakken[Boeknummer] ); FILTER ( ALLSELECTED ( Projecttakken ); Projecttakken[Gewijzigd] IN FILTERS ( 'Calendar'[Date] ) && RELATED ( Statussen[Statuscategorie] ) = "Vervallen" ) )If it does not work, could you please describe the relationship between Projecttakken and Statussen tables simply if it does not contain any confidential information?
Best regards,- mrleijzerHelper I
Thanks!
Using your formula PowerBI says that the column Statussen[Statuscategorie] either doesn't exit or doesn't have a relationship in de current context.
Below an image of the two tables and how they're related (both decimal number format).
- mrleijzerHelper I
Unfortunately I don't remember how I solved this eventually...