The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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
Product | Trans Date | Week Date | Sales |
A | 4/27/21 | 4/26/21 | 10 |
A | 4/30/21 | 4/26/21 | 50 |
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
Solved! Go to 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
Hi, @PradeepDive
Please check the below picture and the sample pbix file's link down below.
All measures are in the sample pbix file.
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
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?
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].
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