Implementing a Slicer to Toggle Between Daily Monthly and Yearly Sales Aggregation

0 votes

Implementing a Slicer to Toggle Between Daily, Monthly, and Yearly Sales Aggregation
Your Power BI report contains a line chart showing sales over time, and the client wants an option to toggle between "Daily," "Monthly," and "Yearly" aggregation using a slicer. What is the best way to implement this using DAX and Power BI features to ensure smooth user interaction?

Mar 5 in Power BI by Evanjalin
• 30,060 points
175 views

1 answer to this question.

0 votes

1. Create an Aggregation Table with values: Daily, Monthly, Yearly.

2. Create a DAX Measure using SWITCH to adjust aggregation:

Sales Aggregation = 
SWITCH(
    SELECTEDVALUE(AggregationTable[Aggregation], "Daily"),
    "Daily", SUM(Sales[Amount]),
    "Monthly", CALCULATE(SUM(Sales[Amount]), VALUES('Date'[YearMonth])),
    "Yearly", CALCULATE(SUM(Sales[Amount]), VALUES('Date'[Year])),
    SUM(Sales[Amount])
)

3. Add a Slicer using AggregationTable[Aggregation] and use Sales Aggregation in a line chart.

answered Mar 5 by anonymous
• 30,060 points

Related Questions In Power BI

+1 vote
3 answers

How do I create a flexible date range slicer that allows users to switch between monthly, quarterly, and yearly views?

Proper date hierarchy and dynamic date filters ...READ MORE

answered Nov 12, 2024 in Power BI by pooja
• 24,290 points
415 views
0 votes
1 answer

How to Toggle Between Two Option and Make it Interact with the rest of the Visualizations in a Report?

Toggling is an action that is achieved ...READ MORE

answered Oct 20, 2020 in Power BI by anonymous
• 65,730 points
1,309 views
0 votes
1 answer

How to add slicer from a different tables?

Hi, Join is normally performed to get ...READ MORE

answered Mar 1, 2019 in Power BI by Cherukuri
• 33,050 points
4,699 views
0 votes
1 answer

How do I add a filter and a slicer?

Hi, Its OLTP and DW modeling. However, you ...READ MORE

answered May 23, 2019 in Power BI by Avantika
• 1,520 points

edited May 23, 2019 by Omkar 980 views
0 votes
1 answer

Displaying Table Schema using Power BI with Azure IoT Hub

Answering your first question, Event Hubs are ...READ MORE

answered Aug 1, 2018 in IoT (Internet of Things) by nirvana
• 3,090 points
1,725 views
+1 vote
1 answer

Unable to install connector for Power Bi and PostgreSQL

I think the problem is not at ...READ MORE

answered Aug 22, 2018 in Power BI by nirvana
• 3,090 points
3,076 views
+2 votes
2 answers

Migrate power bi collection to power bi embedded

I agree with Kalgi, this method is ...READ MORE

answered Oct 11, 2018 in Power BI by Hannah
• 18,520 points
1,866 views
+1 vote
1 answer

Connect power bi desktop to dataset and create custom reports

Open power bi report nd sign in ...READ MORE

answered Oct 10, 2023 in Power BI by Monika kale

edited Mar 5 2,066 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP