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

Measure to know if Date matches in inactive relationship

Hi all

 

I have 2 tables. A date table created with the calendar function in Power BI:

DateTable = CALENDAR("01.01." & YEAR(TODAY())-4; "31.12." & YEAR(TODAY()) + 1)

And table orders. In orders there is the column "OfferDate".

 

In my datetable i need a column that tells me if on the date were an order offered.

The tables are in an inactive relationship, so i know i need to use "Userelationship" but i dont know how to get a bool based on the date.

 

 

Example:

 1.PNG

 

Many thanks

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Got it to work by myself.

FYI

IsOffered = CALCULATE(IF(Max('Orders'[OfferDate]) <> BLANK(); "3");USERELATIONSHIP(DateTable[Date]; 'ssbi Orders'[OfferDate]))

View solution in original post

2 REPLIES 2
jdbuchanan71
Super User
Super User

Hello @Anonymous 

If you are wanting to count the number of lines in the orders table base on the offer date it would be.

Offers = 
CALCULATE(
    COUNTROWS( Orders ),
    USERELATIONSHIP ( Orders[Offer Date], Dates[Date] )
)

If you are just wanting to tag a date if it has at least one offer date in the order table it will be something like

Has Offer = 
VAR Offers = CALCULATE(COUNTROWS(Orders),USERELATIONSHIP(Orders[Offer Date],Dates[Date]))
RETURN IF ( ISBLANK ( Offers ), "N", "Y" )
Anonymous
Not applicable

Got it to work by myself.

FYI

IsOffered = CALCULATE(IF(Max('Orders'[OfferDate]) <> BLANK(); "3");USERELATIONSHIP(DateTable[Date]; 'ssbi Orders'[OfferDate]))

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.