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
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))

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

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
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.