Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

Calculate Maximum value based on Slicer Selection

Hi All,

 

I just wanted to calculate the maximum percentage(Best performer) based on the slicer selection (Quarter, Month, Year).

I also need to calculate the best performer based on various categories.

Lets say Iif i select Q3 in the slicer, the max value of the best performer should be visible.

 

Thanks, 

10 REPLIES 10
v-xicai
Community Support
Community Support

Hi @Anonymous ,

 

You create columns Year, Quarter and Month like DAX below.

 

Year=YEAR(Table1[Date])
 
Quarter =ROUNDUP(MONTH(Table1[Date])/3,0)
 
Month=MONTH(Table1[Date])

 

Then you can create measures Percentage , Rank and Filter1, put the Filter1 in the Visual Level Filter of table visual which displays the Year, Quarter, Month ,Category Slicer 1 , Category Slicer 2 and Percentage, setting Filter1 as "is not blank".

 

Percentage=DIVIDE(SUM(Table1[Value]), CALCULATE(SUM(Table1[Value]), ALL(Table)))
 
Rank= RANKX(ALLSELECTED(Table1),Table1[Percentage],,DESC ,Dense)
 
Filter1=IF([Rank]=1, 1, BLANK())

 

Finally, when you make some selections in slicers, the table visual will return the related maximum percentage record.

 

Best Regards,

Amy

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Ashish_Mathur
Super User
Super User

Hi,

Share some data and show the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
amitchandak
Super User
Super User

Assume your measure is Amount from sales. Calculate a measure like

sales = calculate(sum(sales[Amount]))
overall sales = calculate(sum(sales[Amount]),all(sales)

% of total = divide(sales ,overall sales)

 

You can also try quick measures

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks.

My Recent Blog - https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601

 

 

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
kentyler
Solution Sage
Solution Sage

do you want 1 slicer for month(which implies quarter and year) or 3 slicers, one for month, one for quarter, one for year ?

what data is the percentage being calculated on ? i assume there is a date and an amount, but what is it a percentage of ?

 





Did this post answer your question? Mark it as a solution so others can find it!

Help when you know. Ask when you don't!




Join the conversation at We Talk BI find out more about me at Slow BI


Anonymous
Not applicable

Capture.PNG

I want 3 slicers, one for each month, Quarter and Year. I want category slicer 1 as well.

 
 

I want to calculate the maximum family satisfaction score based on category slicer 1 and in a given time period.

 

Hi,

Write the following calculated column formula to generate a date in this Table

Date = 1*("1/"&Data[Month]&"/"&Data[Year])

Format this column as Date.  Now go to Modelling > New Table and write this formula to create a Calendar Table

Calendar = CALENDAR(MIN(DATA[Date]),MAX(DATA[Date]))

Create a relationship from the Date column of the Data Table to the Date column of the Calendar Table.  In the Calendar Table, write these calulated column formula to extract Year, Month and Qusrter

Year = IF(MONTH(Calendar[Date])>=4,Year(Calendar[Date])&"-"&Year(Calendar[Date])+1,Year(Calendar[Date])-1&"-"&Year(Calendar[Date]))

Month = FORMAT(Calendar[Date],"mmmm")

Quarter = IF(MONTH(Calendar[Date])>=1,"Q4",IF(MONTH(Calendar[Date])>=10,"Q3",IF(MONTH(Calendar[Date])>=7,"Q2","Q1")))

Build 3 slicers - one each for Year, Month and Quarter from the Calendar Table.  Select any one Year, Month and Year.  Build another slicer for Category slicer 1 column and make any selection there.

Write this measure

Measure = MAX(Data[Family satisfaction score])

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

@Ashish_Mathur 

Is it necessary to create a seperate table(Calender table)?
Please note that i do have a date column in my dataset.

Yes, it is necessary.  That is what allows you to use the Date and Time Intelligence functions.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi,

 

I want to pass slicer selection of month and category(multiple values) in calculating the Max family satisfaction score.How can i do that?

Thanks,
Abrarali Surti

That is what my solution should do for you.  Please follow the steps outlined in my previous post.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.