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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
ohnothimagain
Helper I
Helper I

[Basic] userelationship on variable table #2

Hello everyone : )
It's might be a basic but I've been stucking for weeks,hope anyone could tell me..

 

■trying to do

want to calculate schedule fluctuation count.
summarize a table for exculding duplicates,filter product name with a specific condition,

and count [PN] by time series like day,week etc


■Table/DAX/Issues

ohnothimagain_0-1728045806788.png

 

 

test11:=var _tbl=
SUMMARIZE('TEST_','TEST_'[PN],'TEST_'[PO],"@M",min('TEST_'[M_Date]),"@R",min('TEST_'[R_Date]))
var _ftd=filter(_tbl,[@M]<[@R])
var _result=CALCULATE(countrows(_ftd),USERELATIONSHIP('Calendar'[Date],'TEST_'[R_Date]))

return
_result

 

 

=> userelationship don't work.it brings a value of [M_date]

■attached file (I need to do it by powerpivot)
DAX summarize+userelationship 


That's all.thank you for reading and continuing support!
Best regards,

4 REPLIES 4
Anonymous
Not applicable

Hi @ohnothimagain ,

Based on the description, verify that there is an existing relationship between calendar[Date] and TEST[R_Date].

vjiewumsft_0-1728287477506.png

 

Then, try using the following DAX formula.

test11 := 
var _tbl = 
    SUMMARIZE(
        'TEST_', 
        'TEST_'[PN], 
        'TEST_'[PO], 
        "@M", MIN('TEST_'[M_Date]), 
        "@R", MIN('TEST_'[R_Date])
    )
var _ftd = FILTER(_tbl, [@M] < [@R])
var _result = COUNTROWS(
    CALCULATETABLE(
        _ftd, 
        USERELATIONSHIP('Calendar'[Date], 'TEST_'[R_Date])
    )
)
return _result

You can also view the following document to learn more information.

USERELATIONSHIP function (DAX) - DAX | Microsoft Learn

 

Best Regards,

Wisdom Wu

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

Thank you for your reply and support...!

I tried,but....it was the same.relationship is exsiting between [date] and [R_date]

and If I don't use "summarize" ,relationship truely works.

ohnothimagain_0-1728484086871.png

anyone can give me more ideas?
(sorry for incovenient that I'm not available pbix file)

BeaBF
Super User
Super User

@ohnothimagain Try with:

 

test11 :=
VAR _tbl =
SUMMARIZE(
'TEST_',
'TEST_'[PN],
'TEST_'[PO],
'TEST_'[M_Date],
'TEST_'[R_Date]
)
VAR _result =
CALCULATE(
COUNTROWS(_tbl),
'TEST_'[M_Date] < 'TEST_'[R_Date], 
USERELATIONSHIP('Calendar'[Date], 'TEST_'[R_Date]) 
)
RETURN
_result

 

BBF

Thank you for your quick responding!
I tried but unfortunately it was unsuccess(same result).

ohnothimagain_0-1728107369671.png

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.