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
BE_KMI
Regular Visitor

Set value for each line of table based on two date fields

Hallo,

 

I have a sales table where the customer id, and contract id is available and i have an contract table with the contract id and the cancelation date. They are connected via the contract id.

Customer_1.jpg

 

In addition i have an calendar dimension with no connection to the data model where i want to select one day. Therefore i created a slicer and use the minimum date:

select_day.jpg

I created a measure for the "Select Day": Select Day = min(Select Date[Date])

The dimension looks like this:

select_date.jpg

So the selected value is 01.01.2022.

 

What I want to do is to use the Select Day date to decicde if a customer is an "active" or "inactive" customer.

If cancelation date is greater or equal than Select Day it is an active customer.

If cancelation date is lower than Select Day it is an inactive customer.

act_inact.jpg

Cancelation date is and status is not used in the report visual, i need the status only for filtering.

BR

Martin

3 REPLIES 3
rautaniket0077
Resolver I
Resolver I

Try this measure.

Measure  =
SWITCH(
    TRUE(),
    MAX(Contract Table[Cancellation Date]) >= [select_day],"Active","Inactive"
)

if it solve your issue accept my answer as solution

Thank you for your answer. For the example it works fine.selections.jpg

I also tried it at the big data model and there the max cancellation date is wrong. 

As Example: for contract 0200275664 the cancellation date is 25.10.2019:

partner1101.jpg

But when i use the max function for the cancellation date I get 31.12.9999:

cancelation_date_wrong.jpg

For all rows in the visual, the cancellation date is 31.12.9999 and therefore all are active.

Do you have an idea why the behaviour is like that?

Hi @BE_KMI, please provide the sample pbix file.

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