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


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

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.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

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.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

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