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
Anonymous
Not applicable

% of Volume By Agent, Type, and Time Frame

I can't quite figure out a DAX formula that would help me figure out the following.

 

I have the following data laid out as such.

The Calc is a number.

The Type is a line item data label.

The Rep is a sales rep.

And the date, for this is example is set to Quarters in a year.

 

I'm trying to "weave" in and out of the data and look at Per Rep Volume of sales, based on the sales category and Date...

 

It's not the % of the grand total, but the % based on Date, Person, and Sales.

CalcTypeRepDate
7SalesJoeQ1
46HoursJoeQ1
12SalesPaulQ1
45HoursPaulQ1
14SalesFrankQ1
41HoursFrankQ1
8SalesFrankQ2
30HoursFrankQ2
4SalesJoeQ2
32HoursJoeQ2
3SalesPaulQ2
20HoursPaulQ2
6SalesPaulQ3
35HoursPaulQ3
2SalesFrankQ3
36HoursFrankQ3
9SalesJoeQ3
32HoursJoeQ3

 

The desired result is the following:

 

 Q1Q2Q3
Frank42.42%53.33%11.76%
Joe21.21%26.67%52.94%
Paul36.36%20.00%35.29%

 

 

I'm stumped.  I've tried different DAX using Calculate, Sum, and Filter, but it still gives me an error message.

 

Any help would be GREATLY apprec

1 ACCEPTED SOLUTION
ryan_mayu
Super User
Super User

@Anonymous 

please try this

Measure = 
VAR sales=CALCULATE(SUMX(FILTER('Table','Table'[Type]="Sales"),'Table'[Calc]),ALLEXCEPT('Table','Table'[Rep],'Table'[Date]))
VAR total=CALCULATE(SUMX(FILTER('Table','Table'[Type]="Sales"),'Table'[Calc]),ALLEXCEPT('Table','Table'[Date]))
return DIVIDE(sales,total)

1.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

3 REPLIES 3
ryan_mayu
Super User
Super User

@Anonymous 

please try this

Measure = 
VAR sales=CALCULATE(SUMX(FILTER('Table','Table'[Type]="Sales"),'Table'[Calc]),ALLEXCEPT('Table','Table'[Rep],'Table'[Date]))
VAR total=CALCULATE(SUMX(FILTER('Table','Table'[Type]="Sales"),'Table'[Calc]),ALLEXCEPT('Table','Table'[Date]))
return DIVIDE(sales,total)

1.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Anonymous
Not applicable

@ryan_mayu 

Thanks Ryan..  I think it's close, but I may need to tweak it a bit based on how I really have the data laid out.

 

I'm using 3 tables built as relationships between them for ease of data use.

 

The Sales table which has the sales info.

A Rep Table, that has the rep information.

and a Date table that has different variations of dates and time frames such as Quarter, Month, Year, etc.

 

I'm using those 3 to converge everything together.

 

So I've got the majority of the DAX code you supplied set up... I'm kind of stuck now bringing in the Date part for the ALLEXCEPT part, being that DATE is a separate table.  From what it looks like, from what I can see, the AllExcept can only use one table, so what if I'm using 2 tables, in my case of Date and Rep tables?

@Anonymous

I think allexcept can be used for 2 tables. allexcept(table1, table1[column],table2[column]), you can have a try.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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!

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.

Top Solution Authors
Top Kudoed Authors