March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi
I need to analyse some data and get a specific output I am struggeling with:
Raw Data | ||
Company | Revenue | Owner |
Client A | 1000 | Geoff |
Client B | 1500 | Bob |
Client C | 2000 | Steve |
Client A | 1000 | Geoff |
Client B | 2000 | Bob |
Client A | 1500 | Geoff |
Client B | 1000 | Bob |
Client D | 3200 | Geoff |
this is a sample of the data above
I think I need to sum the revenue by company, and allocate the appropriate 'tier' based on the amount of revenue that company has as a whole
For example the sum total of Client A's revenue in the raw data is £3500 which makes them a Tier 2 client
Company | Revenue | Owner | Tier |
Client A | 3500 | Geoff | Tier 2 - £3000-£4000 |
Client B | 4500 | Bob | Tier 3 - £4000 - £5000 |
Client C | 2000 | Steve | Tier 1 - £0 - £2000 |
Client D | 3200 | Geoff | Tier 2 - £3000-£4000 |
I then need an output that tells me how many of each tier, each individual owns. Pretty sure I can just do this with a matrix table once the above calculations have been done
Tier 1 - £0 - £2000 | Tier 2 - £3000-£4000 | Tier 3 - £4000 - £5000 | |
Geoff | 2 | ||
Bob | 1 | ||
Steve | 1 |
Thanks
Here is one way.
First, create a new table using "Enter data" in the ribbon under home and type in:
I have also created dimension tables for Owner and Company. The model looks like this:
Next create two measures :
Customers by group =
COUNTROWS (
SUMMARIZE (
FILTER (
FTable,
[Revenue by company] >= SELECTEDVALUE ( Tier[MinThreshold] )
&& [Revenue by company] <= SELECTEDVALUE ( Tier[MaxThreshold] )
),
'Dim Company'[dCompany],
'Dim Owner'[dOwner]
)
)
And for the final matrix:
Count by Group =
SUMX(Tier, [Customers by group])
Create the matrix with the "Dim Owner" field as rows and the Tier table Groups as columns and add the [Count by group] measure to get:
Proud to be a Super User!
Paul on Linkedin.
Hi @lea_313 ,
Here are the steps you can follow:
1. Create calculated table.
Table 2 =
var _table1=
SUMMARIZE(
'Table',
'Table'[Company],'Table'[Owner],
"Revenue",
CALCULATE(SUM('Table'[Revenue]),FILTER(ALL('Table'),
'Table'[Company]=EARLIER('Table'[Company])&&'Table'[Owner]=EARLIER('Table'[Owner]))))
return
ADDCOLUMNS(
_table1,
"Tier",
SWITCH(
TRUE(),
[Revenue] >=0&&[Revenue]<=2000,"Tier 1 - £0 - £2000",
[Revenue] >2000&&[Revenue]<=4000,"Tier 2 - £3000-£4000",
[Revenue] >4000&&[Revenue]<=5000,"Tier 3 - £4000 - £5000"
))
2. Create measure.
Measure =
COUNTX(
FILTER(ALL('Table 2'),'Table 2'[Owner]=MAX('Table 2'[Owner])&&
'Table 2'[Tier]=MAX('Table 2'[Tier])),[Owner])
3. Result:
If you need pbix, please click here.
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hiya
Thank you for such a deatiled responce and a file to help too
I seem to be getting the wrong tier allocated to the wrong amount of revenue, see pic below
/* Calculated Columns */
TotalRevenue =
VAR _Company = 'DataTable'[Company]
RETURN
CALCULATE(
SUM('DataTable'[Revenue]),
FILTER(
ALL('DataTable'),
'DataTable'[Company] = _Company
)
)
Tier =
IF(
[TotalRevenue] < 2000,
"Tier 1 - 0-2000",
IF(
[TotalRevenue] < 3000,
"Tier 2 - 2000-3000",
IF(
[TotalRevenue] < 4000,
"Tier 3 - 3000-4000",
"Tier 4 - over 4000"
)
)
)
You can use a Matrix with Owner on rows, Tier on columns, and a count of Company in values OR create a calculated table from the results.
When i replace 'data table' with my table name and then the column in [ ], it just shows various errors
I only have a company ID in this data set. This then links to a company master list that would show their company name.
Thanks for the quick help really greateful
Those calculated columns are in DAX not PowerQuery.
Sorry if I wasn't clear.
ok great thanks
Will have a look and see how it works, thanks again
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
134 | |
91 | |
90 | |
64 | |
58 |
User | Count |
---|---|
201 | |
137 | |
107 | |
70 | |
68 |