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
StuartSmith
Power Participant
Power Participant

Create calculated columns dispaying First & Last date from slicer selection

I have a table called "Location" similar to the below...

 

Region Country City Building Date (Today)
EMEA UK London LON01 01/09/2023
EMEA Spain Madrid MAD01 01/09/2023
EMEA France Paris PAR01 01/09/2023
EMEA Germany Berlin BER01 01/09/2023

 

I also have a "Date" table and a "Slicer" with the "Date" column from the "Date" table.  

 

I currently have too many measures and finding it hard with chart visuals, etc. and therefore trying to create a new table using calculated columns instead of measures.  Is it possible to create 2 calculated columns called "FirstDate" & "LastDate" that will display the first and last date of the slicer selection?  So if the Slicer is "January", First date is 01st Jan and Last date is 31st Jan.  To create a relationship between the tables, I created a "Date" column that uses "Todays" date.

 

Region Country City Building Date (Today) First Date Last Date
EMEA UK London LON01 01/09/2023 01/01/2023 31/01/2023
EMEA Spain Madrid MAD01 01/09/2023 01/01/2023 31/01/2023
EMEA France Paris PAR01 01/09/2023 01/01/2023 31/01/2023
EMEA Germany Berlin BER01 01/09/2023 01/01/2023 31/01/2023

 

Thanks in advance.

 

3 REPLIES 3
StuartSmith
Power Participant
Power Participant

I can get columns showing the first and the last date of the Date Table with...

First Date = Min('Table: Date'[Date])
Last Date = MAX('Table: Date'[Date])
but these dates dont change if I select a month from the date slicer.

Hi,

 

try changing the filter context of the measure to allselected e.g:

 

CALCULATE(MAX('Date'[Date]),ALLSELECTED('Date'[Date]))
 
CALCULATE(MIN('Date'[Date]),ALLSELECTED('Date'[Date]))
 
If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

Thanks for replying. I was hoping to go down the "Column" route for "First" and "Last" as currently i have a working report, but its only using a few actual data columns and then about 25 measure columns and as you know, measure columns dont work well with charts, etc.  And want to move the measures to columns.

 

StuartSmith_0-1693568501324.png

If I can just get 2 columns that contain the first and last date of the slicer selection, I can then move all the measures also across to columns and then charts.  But date columns dont filter with the slicers (see top table).

 

If having "First" and "Last" date as columns isnt possible, is there a way to create columns that look at the measures as if I create a "Networkdays" column to look at the date measures, it doesnt count the number of days.

 

I have attacehd an example .pbix file.  Date Columns 

 

Thanks in advance.

 

 

 

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.

Top Solution Authors