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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Oros
Post Prodigy
Post Prodigy

Filtered measure

Hello,

 

I have the following table. What would be the correct measure to use so that if a year and salesperson is selected, the specific salesperson's sales (for the selected year) will be calculated against the total sales for the selected year?  Thanks.

 

For example, if 2021 is selected and Bob is selected:

Total Sales = $150

Bob's Sales = $50

 

(need help in this mesure below)

Measure = $50 / $150 = 33.33%

 

Oros_0-1725146343429.png

 

 

2 ACCEPTED SOLUTIONS
Irwan
Super User
Super User

hello @Oros 

 

please check if this accomodate your need.

Irwan_0-1725152564068.png

 

create a new measure with following DAX.

Measure = 
var _Salesperson = SELECTEDVALUE('Table'[SALESPERSON])
var _Year = SELECTEDVALUE('Table'[Year])
Return
DIVIDE(
    CALCULATE(SUM('Table'[Sales]),FILTER(ALLSELECTED('Table'),'Table'[SALESPERSON]=_Salesperson&&'Table'[Year]=_Year)),
    CALCULATE(SUM('Table'[Sales]),FILTER(ALL('Table'),'Table'[SALESPERSON]=_Salesperson))
)
 

Hope this will help.

Thank you.

View solution in original post

Ashish_Mathur
Super User
Super User

Hi,

PBI file attached.

Hope this helps.

Ashish_Mathur_0-1725160874041.png

 


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

View solution in original post

9 REPLIES 9
Ashish_Mathur
Super User
Super User

Hi,

PBI file attached.

Hope this helps.

Ashish_Mathur_0-1725160874041.png

 


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

Hi @Ashish_Mathur ,

 

Thank you for your reply.  Your solution works, except that it always calculates at 100% any salesperson selection.  Any ideas?  Thanks again.

 

(You solution works.  ONLY when all salespersons are selected, the % becomes 100%)

Oros_0-1725240400381.png

Oros_1-1725240463840.png

(applying your solution to my context only works and shows 100% when all salespersons are selected)

Oros_2-1725240556116.png

BUT when only a salesperson is selected, the 100% still shows up, instead of the particular percentage for the selected salesperson. If I would select the second salesperson only, the Sales and ALL Sales columns become equal, and therefore becomes 100%.  The $43,116.98 (all sales) is not showing up anymore.

Oros_3-1725240702987.png

 



Very confused about what you want.  What s wrong with my solution?


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

Hi @Ashish_Mathur,

My bad...I overlooked at one of the table relationships.  As usual, thank you so much for your kind help. 🙂

 

You are welcome.


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

hello @Oros 

 

please check if this accomodate your need.

Irwan_0-1725152564068.png

 

create a new measure with following DAX.

Measure = 
var _Salesperson = SELECTEDVALUE('Table'[SALESPERSON])
var _Year = SELECTEDVALUE('Table'[Year])
Return
DIVIDE(
    CALCULATE(SUM('Table'[Sales]),FILTER(ALLSELECTED('Table'),'Table'[SALESPERSON]=_Salesperson&&'Table'[Year]=_Year)),
    CALCULATE(SUM('Table'[Sales]),FILTER(ALL('Table'),'Table'[SALESPERSON]=_Salesperson))
)
 

Hope this will help.

Thank you.

Hi @Irwan,

 

Your solution also works!  Thanks for your help!

Hello @Irwan,

 

Thank you for your quick reply.  What if I have a separate calendar table.  What should be the exact measure to use?  Thanks again.

Oros_0-1725157658974.png

Oros_1-1725157684663.png

 

hello @Oros 

 

since this is measure, you can change a little bit in _Year.

Measure =
var _Salesperson = SELECTEDVALUE('Table'[SALESPERSON])
var _Year = SELECTEDVALUE('Table (2)'[Year])
Return
DIVIDE(
    CALCULATE(SUM('Table'[Sales]),FILTER(ALLSELECTED('Table'),'Table'[SALESPERSON]=_Salesperson&&'Table'[Year]=_Year)),
    CALCULATE(SUM('Table'[Sales]),FILTER(ALL('Table'),'Table'[SALESPERSON]=_Salesperson))
)
Here is the result, show the same result even though it takes value from different table ('Table (2)').
Irwan_0-1725159764323.png

the slicer is also taking value from the Date table.

Irwan_1-1725159941028.png

 

Hope this will help.

Thank you.

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.