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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
dewinterpau
New Member

Comparing dates from slicer and column without relationship between tables

I would like to create a measure, probably in the way of an if-statement where I'm able to compare a maxdate and mindate from a slicer from a calender table to the the dates of transport which are placed in a column. With this feature, I would like to create a selection of the rows where transport costs have to be applied and which not. The thing is, is that there can't be a relationship between the calender table(where the slicer is based on) and the table of the transport dates because at any time, those transports need to stay visible in the table, whatever the selection of the slicer may be, because of a rent calculation that is based on the previous transports. Does anyone know how to achieve this or maybe has another approach?

2 REPLIES 2
dewinterpau
New Member

Hi Sanket,

 

Thanks for your reply!

Unfortunately, I couldn't solve the issue with your solution. The way I achieved to solve this issue was by using if statements in combination with the "selectedvalue" function. This way you're able to combine measures and column values in an if statement and that solved the problem fortunately.

SanketBhagwat
Solution Sage
Solution Sage

Hi @dewinterpau .

In that case you can use the following steps;

1)Create measures for MaxDate and MinDate.

 

2)Create a table having the name of the measures as its column value.

Click on 'EnterData' and type the values.

In my case I am creating a table named Measures and column name as Selection.

I am putting values in there as 'MaxDate' and 'MinDate'.

 

3)Create a measure using SWITCH as is required by you;

For Example;

Measure1=var selectedTop=SelectedValue('measure'[selection])
Return
Switch(True(),
 var selectedTop="MaxDate",[MaxDate],varselectedTop="MinDate",[MinDate],BLANK()).

 

4)Drag a slicer and add the table measure[selection] field in it.

 

5)Drag a table and add required fields and add the 'Measure1' measure into it.

 

If this post helps you, then please do mark it as 'Accept as Solution' and give it a big thumbs up.

 

Regards,

Sanket Bhagwat.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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