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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

How to pass the dates selected from slicer to create a new table

Hi gurus,

 

Please advise what's the best solution to pass the selected date to a table? 

I am able to get the result of the selected value as date however it doesn't seem to be passing it correctly.

 

Selected Day1 = DATEVALUE(SELECTEDVALUE(UnionTable[Current Report Date]))
 
In my table, I would like to pass the Selected Day1
 
ViewCompare =
SUMMARIZE( FILTER( UnionTable, UnionTable[Current Report Date] = [Selected Day1]),
UnionTable[Contract_Coins],
UnionTable[Current Report Date],
UnionTable[Date],
UnionTable[Previous Forecast]
)

*** If I change the Selected Day 1 to another measure which has a date calculation, it is able to pick it up.
Example if I pass "Friday Last Week" instead of the "Selected Day1", the table is created with the correct values.
Friday Last Week = TODAY() - WEEKDAY(TODAY(),2) - 2

Another question is : How do I get the maximum date from the selected values? 
 
Thank you.
8 REPLIES 8
V-pazhen-msft
Community Support
Community Support

@Anonymous 

I confused with the table and expected output.  This is what I have now. I create a distinct table as the slicer, then create a variance measure.

Vpazhenmsft_0-1633053143088.png

 

 

Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hi Paul,

 

Thanks for simulating my model. In the pbix that you've created, the variance was computed based on the "date" column. My requirement is to compute the variance based on the reporting date on each date. There should only be 1 variance column as per my output.

 

So if we go back to my output, in my slicer if I select 09/05 & 06/05. 

You will see there that there is a variance shown as only 1 column; i.e., it is subtracting the 9/05/2021 value - 6/05/2021 value.

***** Note: I need these dates to be dynamic in such a way that if I select from my slicer 2 dates, it will reflect my columns as those selected dates and the variance should automatically subtract reporting date 1 - reporting date 2.

 

Thank you.

 

Fowmy
Super User
Super User

@Anonymous 

Selection made from the report slicers is not visible to the data model when you create a table.  

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Anonymous
Not applicable

Hi @Fowmy,

 

Thanks for your reply. You've got the same answer as @amitchandak  where I can't achieve what I'm trying to do with the table. Now I'm back at square 1 where I needed to get the variance of the the data on the rows as per the selected values in the slicer. Any suggestion for this?

 

mafs_0-1632840332010.png

 

amitchandak
Super User
Super User

@Anonymous , example

 

measure =
var _tab = summarize(filter(all(Table), Table[customer] in allselected(Table[Customer])),Table[product])
return
calculate(coutrows(Table), filter(all(Table), Table[product] in _tab))

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
Anonymous
Not applicable

Sorry, I'm still confused. Where do I pass my Selected Day1 using the var table?

amitchandak
Super User
Super User

@Anonymous , You can not use slicer value in new calculated table.

 

You can use slicer value only in VAR Table, inside a measure

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
Anonymous
Not applicable

Hi @amitchandak,

 

Thanks for your quick reply.

Is it possible for you to to give an example in the context to what I am trying to build please? I haven't tried using var table.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.