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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
luis951225
Regular Visitor

get selected date in slicer on new column

good afternoon

 

I need in a column or measure, calculate the difference of days between the selected dates in the slicer ... some function?

 

I speak Spanish.

 

 

the image in the link

 

https://www.dropbox.com/s/pe0hen9ghx65r8d/Captura12.PNG?dl=0


 

1 ACCEPTED SOLUTION

Hi @luis951225,

Please use the following formula, I have tested it in my sample data table, it works fine.

Measure =
DATEDIFF (
    CALCULATE ( MIN ( DateTable[Date] ), ALLSELECTED ( DateTable ) ),
    CALCULATE ( MAX ( DateTable[Date] ), ALLSELECTED ( DateTable ) ),
    DAY
)


Best Regards,
Angelia

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi,  I have a similar issue, but I am not trying to calculate a date difference. 

 

My situtation is that I have a Sprint Name column.  When the user selects the Sprint, I set a measure called 'SelectedSprintStart' to the selected Sprint's start date. 

 SelectSprintStart = CALCULATE(LASTDATE(Sprints[Start Date]),FILTER(ALLSELECTED(Sprints),Sprints[Sprint Name]=SELECTEDVALUE(Sprints[Sprint Name])))
 
This works fine.  The value is set.  But...   
I have a Burndown Table.  The Static Burn down Table that has a [Sprint Day] Column with 14 rows.  Each row representing a Day of the sprint. 
 
I need to set the Burndown Row Date by taking the ' SelectSprintStart' date and Adding the [Sprint Day] no to it.  But for some reason this date that is stored in the SelectSprintStart will not present as a date ro any value at all in the calculation.  
 
It seems I cannot use the SelectedSprintStar in any calculation for a column row.  The data is just not reckognized at all.  
 
Any help would be appreciated. 
Zubair_Muhammad
Community Champion
Community Champion

Hi @luis951225

 

Try this MEASURE

 

Measure =
DATEDIFF ( MIN ( TableName[Date] ), MAX ( TableName[Date] ), DAY )

Hi,

 

Hello, The dates you want to obtain are in a slicer !!

Hi @luis951225,

Please use the following formula, I have tested it in my sample data table, it works fine.

Measure =
DATEDIFF (
    CALCULATE ( MIN ( DateTable[Date] ), ALLSELECTED ( DateTable ) ),
    CALCULATE ( MAX ( DateTable[Date] ), ALLSELECTED ( DateTable ) ),
    DAY
)


Best Regards,
Angelia

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.