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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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