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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

broken relation with date dax table

Hello,

 

I have a dax table as follow

Date = CALENDAR(DATE(2018,1,1),DATE(2030,12,31))

 

And a fact table with sales and report repiod (multiple with same time/date).

 

I made a link one to many but it seems don't work.

 

If i call values from calendar it doens't compute values (report time).

 

Whant i can do to fix this ?

 

Regards.

2 ACCEPTED SOLUTIONS

You really need to post an image of your model. You should not need USERELATIONSHIP. It is not clear if [report period] is a date. You should not be using the fact column inside SAMEPERIODLASTYEAR



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.

View solution in original post

Anonymous
Not applicable

I finaly added a segment with the Report[Report Period] and it works @MattAllington  !

I wonder how ? Did it regroupe the report ?

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hello Matt,

It doens't works even if i force the relas if i force this column usage.

I have simply changed the date on both sides to DD/MM/YYYY to test it.


Maybe i am doing wrong ? Total YTD LY return me an error with the following code:

Total YTD =
CALCULATE (
SUM(Report[Revenue USD]),
DATESYTD ( Report[Report Period] ),
USERELATIONSHIP (Report[Report Period],'Date'[Date] )
)

Total YTD LY =
CALCULATE (
[Total YTD],SAMEPERIODLASTYEAR(Report[Report Period] ),
USERELATIONSHIP (Report[Report Period],'Date'[Date] )
)

Error Message:
MdxScript(Model) (56, 17) Erreur de calcul dans la mesure 'Report'[Total YTD LY] :
La fonction « SAMEPERIODLASTYEAR » attend une sélection contiguë quand la colonne de date n'est pas unique, est discontinue ou contient une partie heure.


Regards.

You really need to post an image of your model. You should not need USERELATIONSHIP. It is not clear if [report period] is a date. You should not be using the fact column inside SAMEPERIODLASTYEAR



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
Anonymous
Not applicable

Thank you for your reply,

 

i modified the code for both measures but i have the same amount for Total YTD LY and Total YTD (i should have less for YTD LY):

Total YTD =
CALCULATE (
SUM(Report[Revenue USD]),
DATESYTD ( Report[Report Period] )
)
Total YTD LY =
CALCULATE (
[Total YTD],SAMEPERIODLASTYEAR('Date'[Date] )
)

(I put some blank on other fields)

Capture.PNG

 

 

 

 

 

 

 

 

 

 

 

 

Report period (each client has his report with the same report period for each month):
Capture.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Regards

 

 

Anonymous
Not applicable

I finaly added a segment with the Report[Report Period] and it works @MattAllington  !

I wonder how ? Did it regroupe the report ?

Split the date/time column in the fact table into 2 columns, one for date, one for time. Then join on date



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors