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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
RenanSSimao
Frequent Visitor

DAX Function to filter by quarter and sum with measure

https://1drv.ms/u/s!AnPIqJrsY30EhFQSmQCrXuQy-U1B?e=oecpxg (FILES)

Hello everyone! I made a generic data based on my real data to try to explain to you my issue.
This is an example of my sheet. Each "Liderança" or "Leadersheep" has a goal to Visit 3 places per quarter. Each different "ID" represents a differente visist, so first of all I made a DistinctID = DISTINCTCOUNT(Sheet[ID]to count how many visits were made by each Leadersheep/Engineer.

RenanSSimao_0-1677244989785.png

Sometimes, the engineer makes more visits than their goal per quarter (3 visits) so I made another measure to transform all those surplus to maximum 3  / #MaxMeasure = if([DistinctID]>=3,3,[DistinctID]).

So I have this simple visualition to show if the enginneers are achieving their goals per quarter:

RenanSSimao_1-1677245268400.png

The problem is: When I selected each Leadersheep the graphic works fine, showing the correct %, but, when I don't select any leadersheep the graphic shows every quarter with 100% because it sums every visist and that sunplus the goal which is 3

RenanSSimao_2-1677245401510.png


I'm having trouble separating the correct number for each leadersheep, because, if one leader makes 10 visits and the other makes 2, the graph shows that the goal is ok, since the sum is 12, but doesnt show that one leader made less visits than necessary.

I hope I was clear enough but any questions I can try to explain differently!

Thank you a lot

 

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

*Measure Quarter =
var a=SUMMARIZE(Sheet,Sheet[Liderança],"visits",min(DISTINCTCOUNT(Sheet[ID]),3))
return divide(sumx(a,[visits]),COUNTROWS(a)*3)
 
see attached

View solution in original post

8 REPLIES 8
lbendlin
Super User
Super User

*Measure Quarter =
var a=SUMMARIZE(Sheet,Sheet[Liderança],"visits",min(DISTINCTCOUNT(Sheet[ID]),3))
return divide(sumx(a,[visits]),COUNTROWS(a)*3)
 
see attached

@lbendlin , hello again!

If you don't mind answering, I was wondering if there is a way to show a card with the average of visits per quarter. For example:

RenanSSimao_0-1677512610634.png


Is there a way to use this "new data" from the new summarazed table and take the average of it per quarter?


Thank you a lot



the average of visits per quarter

that would require a single card. However your description 

lbendlin_0-1677521851389.png

seems to expect four different cards, each for the YTD of the respective quarter.  How would that work in the UI?

Yes, sorry. I thought one thing and wrote another, you're right.

I mean a single card that shows the average of that result showing on the graph for the entire year, in that case, if I would be able to sum that total showing for each column in the graph and divide it by 4 (total of quarters).


Add the measure to the card, aggregate as average.

Hello Ibendlin!

I don't understand how to aggregate a measure as average in Power Bi, since I can only select the aggregate options when choosing a column, not a measure.

Thank you

you do that in the measure definition.

Hello @lbendlin !

Thank you very much, that works perfectly.

 

Thanks!

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.