Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
I have a table containing data with columns containing a reference (non-unique) and a type (non-unique). A representation is below:
TableA
Reference | Type | Value |
A123 | Type1 | 5521 |
A123 | Type1 | 321 |
A123 | Type2 | 10 |
B321 | Type1 | 450 |
B321 | Type2 | 300 |
C231 | Type1 | 5000 |
C231 | Type2 | 500 |
C231 | Type2 | 550 |
... | ... | ... |
I would like to create a new summary table that has a row for each reference and columsn that some the values for each type, as below:
TableB
Reference | Type1 | Type2 |
A123 | 5842 | 10 |
B321 | 450 | 300 |
C231 | 5000 | 1050 |
Solved! Go to Solution.
@ddalton create this calculated table:
TableB =
ADDCOLUMNS(
VALUES('TableA'[Reference]),
"Type1", CALCULATE(SUM('TableA'[Value]),'TableA'[Type] = "Type1"),
"Type2", CALCULATE(SUM('TableA'[Value]),'TableA'[Type] = "Type2")
)
@ddalton create this calculated table:
TableB =
ADDCOLUMNS(
VALUES('TableA'[Reference]),
"Type1", CALCULATE(SUM('TableA'[Value]),'TableA'[Type] = "Type1"),
"Type2", CALCULATE(SUM('TableA'[Value]),'TableA'[Type] = "Type2")
)
As simple as that 😉
Thanks!
@ddalton my pleasure 🙂
Hey, check out my showcase report - got some high level stuff there. Sure you will find there a lot of cool ideas.
https://community.powerbi.com/t5/Data-Stories-Gallery/SpartaBI-Feat-Contoso-100K/td-p/2449543
Give it a thumbs up over there if you liked it 🙂
The original table also has some other columns in it that would be useful. For example, there could be a customer reference that is specific to the reference
Reference | Type | Value | Cust |
A123 | Type1 | 5000 | AAA |
A123 | Type2 | 150 | AAA |
A123 | Type2 | 300 | AAA |
B321 | Type1 | 4500 | BBB |
B321 | Type1 | 1500 | BBB |
B321 | Type2 | 100 | BBB |
B321 | Type2 | 250 | BBB |
C231 | Type1 | 1000 | AAA |
C231 | Type2 | 350 | AAA |
C231 | Type2 | 150 | AAA |
So, in addition to your original solution, could I also include the Cust column in the data set? i.e.,:
Reference | Type1 | Type2 | Cust |
A123 | 5000 | 450 | AAA |
B321 | 6000 | 350 | BBB |
C231 | 1000 | 500 | AAA |
@ddalton for each refrence there can only be 1 customer?
Please don't check out my showcase report and give it a thumbs up over there if you liked it 🙂
https://community.powerbi.com/t5/Data-Stories-Gallery/SpartaBI-Feat-Contoso-100K/td-p/2449543
Ah. No, there is more than one reference per customer. I've updated the original reply above to include, for example, reference C231 and show that is also linked to Cust AAA.
So, there is multiple references per customer.
@ddalton you mean like this? :
TableB =
ADDCOLUMNS(
ALL('TableA'[Reference], TableA[Cust]),
"Type1", CALCULATE(SUM('TableA'[Value]),'TableA'[Type] = "Type1"),
"Type2", CALCULATE(SUM('TableA'[Value]),'TableA'[Type] = "Type2")
)
Exactly like that. Thank you!
@ddalton my pleasure 🙂
Don't forget about the report please 🤣.
https://community.powerbi.com/t5/Data-Stories-Gallery/SpartaBI-Feat-Contoso-100K/td-p/2449543
Give it a thumbs up over there if you liked it 🙂
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
145 | |
87 | |
66 | |
51 | |
45 |
User | Count |
---|---|
215 | |
90 | |
83 | |
66 | |
58 |