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

How to calculate a sum/average based on a slicer that we selected?

Hello, I am new to Power BI. This is my first day using it, actually.

 

I have created a visual that depicts the amount of productions in my company, daily. I also made a slicer where I can select which days should I depict in the visual, for example: the last seven days.

 

Now, my question is, how can I create a Measure based on the average or sum of values that I selected in the slicer? So, it's variable, like when I select the last 30 days, then the Measure will show a single sum value of productions in the last 30 days.

 

I have tried to create a graph, using AVERAGEX, but what I need is a single value that I can show, not a graph. Is there any way to solve this problem?

 

Thank you.

1 ACCEPTED SOLUTION

@Anonymous 


I think I am not getting it, If you change the dates to las 10 days, it filters as you need and the total for the past 10 days

Fowmy_0-1634461371684.png

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

5 REPLIES 5
Fowmy
Super User
Super User

@Anonymous 

Sorry, not clear enough. 
Can you share some sample data with the desired output to have a clear understanding of your question? Mention whether you want a calculated column or measure
You can save your files in OneDrive, Google Drive, or any other cloud sharing platforms and share the link here.


Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Anonymous
Not applicable

Hey @Fowmy , so far I created a graph of dynamic moving average (helped by a what if parameter) like this:

 

DRA =
var sum_in_period = CALCULATE(SUM(Produksi[NiProduction-Actual]), DATESINPERIOD(Produksi[Date],LASTDATE(Produksi[Date]),Parameter[Parameter Value],DAY))
var days_in_period = CALCULATE(DISTINCTCOUNT(Produksi[Date]), DATESINPERIOD(Produksi[Date],LASTDATE(Produksi[Date]), Parameter[Parameter Value],DAY))
return
sum_in_period/days_in_period
 
However, this is a GRAPH,  a moving one. How about a SINGLE value? So, if I wanted the value of the last 10 days only, it shows, 20K for example.
Anonymous
Not applicable

This is the link to the sample file: https://drive.google.com/file/d/1PnCOlHLY1ed4V6H95z4igeRjM0VWsXUa/view?usp=sharing.

 

I want MEASURE, not calculated column.

 

You can see that I have the data of the last 36 days, and I have a slicer in which I can choose the range of days I want, for example the last 30 days. Now I want the SUM of the data in the range that I chose in the slicer, to be put in the Card below. Right now in the Card, I can only do a Measure (SUM) of the whole column, but as I said before, I want the value to be the sum of the data that I chose in the slicer (the last 30 days). And I want it to change depending on my slicer.. so when I changed the slicer to be the last 10 days only, the value in the Card will be a SUM of the last 10 days only.

 

Do you get me? I am sorry I am not a native English speaker.

@Anonymous 


I think I am not getting it, If you change the dates to las 10 days, it filters as you need and the total for the past 10 days

Fowmy_0-1634461371684.png

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Anonymous
Not applicable

Jesus you're right. No I'm sorry, it's my fault that I didn't see that! It's exactly what I need, thanks. Sorry.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.