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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
mrleijzer
Helper I
Helper I

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:

 

Measure = CALCULATE(COUNT(Projecttakken[Boeknummer]);Statussen[Statuscategorie]="Vervallen";USERELATIONSHIP('Calendar'[Date];Projecttakken[Gewijzigd]))

 

As I check I expect to see 39 records, but the measure outcome is (Blank).

 

What am I doing wrong? 

17 REPLIES 17
luamar
Regular Visitor

@mrleijzer did you find any solution to this? I am having exactly the same issue

Unfortunately I don't remember how I solved this eventually...

mrleijzer
Helper I
Helper 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 records
 
So when I add USERELATIONSHIP
 
Measure=
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?

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,

 

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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).

table relationship.png

Hi @mrleijzer ,

 

Thank you for your additional information, could you please try to use the following measure?

 

Measure =
CALCULATE (
    COUNT ( Projecttakken[Boeknummer] );
    FILTER (
        ALLSELECTED ( Projecttakken );
        Projecttakken[Gewijzigd] IN FILTERS ( 'Calendar'[Date] )
    );
    Statussen[Statuscategorie] = "Vervallen"
)


Best regards,

 

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks Dong Li, but it's still coming up blank.

Hi @mrleijzer ,

 

How about the result after you follow the suggestions mentioned in my original post?Could you please provide more details about it If it doesn't meet your requirement?


Best regards,

 

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Sorry for not replying earlier.

I don't use filters, everything is filtered in measures.

I tried your calculations nevertheless but this also didn't work. Thanks for the suggestion.

Hi @mrleijzer ,

 

Where are you applied the 'Date'[Date] column, in the table visual or in the filter? We can try to use the following measur if you use it in the filter:

 

Measure =
CALCULATE (
    COUNT ( Projecttakken[Boeknummer] );
    FILTER (
        CALCULATETABLE (
            ALLSELECTED ( Projecttakken );
            'Calendar'[Date]
        );
        Projecttakken[Gewijzigd]
            IN FILTERS ( 'Calendar'[Date] )
    );
    Statussen[Statuscategorie] = "Vervallen"
)

 

Measure =
CALCULATE (
    COUNT ( Projecttakken[Boeknummer] );
    FILTER (
        ALL ( Projecttakken );
        Projecttakken[Gewijzigd]
            IN FILTERS ( 'Calendar'[Date] )
    );
    Statussen[Statuscategorie] = "Vervallen"
)

 


Best regards,

 

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
mrleijzer
Helper I
Helper 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 ;)!

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.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

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.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Unfortunately, RM&C won't allow me to share this report / data.

Ashish_Mathur
Super User
Super User

Hi,

Does this work?

Measure = CALCULATE(COUNT(Projecttakken[Boeknummer]);Statussen[Statuscategorie]="Vervallen";USERELATIONSHIP(Projecttakken[Gewijzigd];'Calendar'[Date]))


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
amitchandak
Super User
Super 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/

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
JarroVGIT
Resident Rockstar
Resident Rockstar

Hi @mrleijzer ,

Your measure should work just fine. Only thing I can think of is that you are not actually filtering on the date calendar but on you have a filter set through the Boekdatum column?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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