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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Anonymous
Not applicable

Calculation within a Matrix using Number of Days selected in Page level filter

I'm currently creating a matrix within a Power BI dashboard which looks similar to the following layout (apologies cannot share the real dataset for confidentiality reasons):

 

DateResource IdentifierHourly CostAnnualised Cost
19/04/2022A10.15$3.91
 A20.20$5.21
 A30.26$6.78
20/04/2022B60.10$2.61
 B70.12$3.13
 B200.88$22.94

 

The annualised cost is the calculated field here and the logic required is:

 

Annualised Cost = Hourly Cost / Number of Selected Days x 365

 

The number of selected days should be derived from the number of days selected within the page level filter and as such, if the user changes the number of selected days, the annualised cost shoudl also change. Is there a way to do this within a matrix? I've been playing around with it and it always sets the number of selected days as 1. 

 

Thanks in advance for your help!

4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

Assuming the user select a beginning and ending date in the Page filter, the number of selected days can be derived by this measure:

Selected days = max(calendar[date])-min(calendar[date])+1

Hope this helps.


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

Hi Ashish,

 

Thanks for your response.

 

Normally, I can work out the number of selected days (it's a selection of individual days) with a DISTINCTCOUNT on the date field. However, as this is in a matrix, using DISTINCTCOUNT always shows up as count of 1.

 

Can you think of a way to tackle this problem?

Hi, @Anonymous 

Not fully sure what you want.

Can you share a sample pbix file for further research?

Best Regards,
Community Support Team _ Eason

I cannot understand your question.


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

Helpful resources

Announcements
October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.