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
PradeepDive
Helper II
Helper II

Get Column in table as per selection on Slicer

Hi All,

 

Need help. I have one table for Sales and two seperate columns for date, one each for Daily and week (Week Start Dt Monday)

 

My Data looks something like this

ProductTrans DateWeek DateSales
A4/27/214/26/2110
A4/30/214/26/2150

 

What I am trying to achive is to provide a slicer as Daily / Weekly and the the table should show the Date column and other details based on selection.

 

For example :   if user selects Daily then the table visual should show Product, Date (Trans Date) and Sales (total for date)

                        and if user select Weekly then table visual should show Product, Date (week Date) and Sales (total for week)

 

Thanks

1 ACCEPTED SOLUTION

Got it I was missing that part due to which were not able to get the expected result.  

I will give it a try.  

 

Thank you

View solution in original post

6 REPLIES 6
Jihwan_Kim
Super User
Super User

Hi, @PradeepDive 

Please check the below picture and the sample pbix file's link down below.

All measures are in the sample pbix file.

 

Picture7.png

 

Sales Total by slicer =
SWITCH (
SELECTEDVALUE ( Slicer[Slicer], "Daily" ),
"Daily",
CALCULATE (
[Sales Total],
TREATAS ( VALUES ( Slicer[Link] ), 'Calendar'[Date] )
),
"Weekly",
CALCULATE (
[Sales Total],
TREATAS ( VALUES ( Slicer[Link] ), 'Calendar'[Start of Week] )
),
CALCULATE (
[Sales Total],
TREATAS ( VALUES ( Slicer[Link] ), 'Calendar'[Date] )
)
)

 

 

https://www.dropbox.com/s/3yw7h92dwz5dyel/pradeepdive.pbix?dl=0 

 

Hi, My name is Jihwan Kim.

 

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

 

Linkedin: linkedin.com/in/jihwankim1975/

Twitter: twitter.com/Jihwan_JHKIM

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Thank you for you reply,

I checked the formula above but it is giving me total of sales. What I am trying to get is based on slicer selection (daily / weekly) the date column (Link in your case)  should change. 

 

Am I missing anything in your solution  ?

Hi, @PradeepDive 

Thank you for your feedback.

Because the slicer is selecting Weekly, it is showing the weekly total.

If you select Daily, then each date will show in the visualization.

Can you describe what do you want to see when you select Weekly in the slicer? Do you want to see all dates separately in that specific week? 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


That's how I wanted,

 

Due to org security I can not download the pbix you attached. Can you please share what is there under Slicer[Link]  

 

Hi, @PradeepDive 

I am not sure how to describe in words what is under Slicer[Link].

It is the union column of Calendar[Date] and Calendar[Start of Week].

Picture1.png

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Got it I was missing that part due to which were not able to get the expected result.  

I will give it a try.  

 

Thank you

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.