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

Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register now.

Reply
MohannadSh1996
Microsoft Employee
Microsoft Employee

Calculate percentages based on different dates granularity

Hi Guys,

 

I have a data as:

 

-DateTime ("yyyy-MM-dd")

-ReachedUsers

-SuccessReachedUsers

-ReachedRate : SuccessReachedUsers / ReachedUsers


I have the data shown per day (days granularity) but i wish to have a button to show them by months.

What i want to do is to have a toggle button consist of Days and Months and by selecting Days i'll get the following data:
Days.PNG

and by selecting Month button i'll get:
Months.PNG

I'd appreciate if anyone knows if this can be done and how?

1 ACCEPTED SOLUTION

hi  @MohannadSh1996 

For your case, you'd better use bookmark in power bi.

https://radacad.com/bookmarks-and-buttons-making-power-bi-charts-even-more-interactive

 

and for the total problem, it seems that total of each day in march on first picture is not same as second picture in mar.

If it is a measure total problem? 

please see this post about it
https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376

Also, this Quick Measure, Measure Totals, The Final Word should get you what you need:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907

 

If not your case, please share your sample pbix file and your expected output.

 

Regards,

Lin

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

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

You can use ALLSELECTED instead of ALL to do this.

To make your measure as general as possible (based on your current model), you could write

 

P Mix =
DIVIDE (
SUM ( Sheet1[Prior Volume] ),
CALCULATE (
SUM ( Sheet1[Prior Volume] ),
ALLSELECTED ( Sheet1[Product Hier], Sheet1[Product Hier lvl 1], Sheet1[Product Hier lvl 2] )
)
)
Using this measure, the denominator would be determined by any slicers filtering the table.

 

For convenience, it might be better to have a Product table related to your existing table, which would simplify the above measure since you could write ALLSELECTED ( 'Product' ).

@Anonymous 
ALLSELECTED  will not solve the problem .. could you please send a more clear query to calculate total by month?

hi  @MohannadSh1996 

For your case, you'd better use bookmark in power bi.

https://radacad.com/bookmarks-and-buttons-making-power-bi-charts-even-more-interactive

 

and for the total problem, it seems that total of each day in march on first picture is not same as second picture in mar.

If it is a measure total problem? 

please see this post about it
https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376

Also, this Quick Measure, Measure Totals, The Final Word should get you what you need:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907

 

If not your case, please share your sample pbix file and your expected output.

 

Regards,

Lin

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

Hi @v-lili6-msft , Thank you for your answer, i do believe that the bookmark is the most suitable solution in my case, but i can't share the pbix file due to the sensentive data that i have.


 

amitchandak
Super User
Super User

@MohannadSh1996 ,While you can switch Measure using slicer. I think in this case you have to use bookmark

https://radacad.com/bookmarks-and-buttons-making-power-bi-charts-even-more-interactive

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak, but how to get the total of column or the percentages of two columns per month?

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

Check out the April 2025 Power BI update to learn about new features.

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

Find out what's new and trending in the Fabric community.