The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hello,
I have the below table structure, where blue is fact and I need to calculate three additional columns.
One of them I managed to calculate, but I can't find a way to calculate the other two (which are actually interlinked.
Can you please help?
Distinct Cat Concatenation | CONCATENATEX(FILTER(SUMMARIZE(Table1,Table1[Deal],Table1[Cat]),Table1[Deal]=EARLIER(Table1[Deal])), Table1[Cat]," | ") |
Cat Qty | need help, tried CALCULATE(SUM(Qty),Table1[Deal]=EARLIER(Table1[Deal]),(Table1[Deal])), Table1[Cat]) and it does not work |
Distinct Cat & Qty Concatenation | need help |
Solved! Go to Solution.
Hi @ChPetru ,
I have modified my original reply, please check.
Best Regards,
Jinwei Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @ChPetru ,
I have modified my original reply, please check.
Best Regards,
Jinwei Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @ChPetru
According to your description, you want:
Please try:
Cat Qty =
CALCULATE (
SUM ( Table1[Qty] ),
FILTER (
'Table1',
'Table1'[Deal] = EARLIER ( 'Table1'[Deal] )
&& 'Table1'[Cat] = EARLIER ( Table1[Cat] )
)
)
Distinct Cat Concatenation =
CONCATENATEX (
FILTER (
SUMMARIZE ( Table1, Table1[Deal], Table1[Cat] ),
Table1[Deal] = EARLIER ( Table1[Deal] )
),
Table1[Cat],
" | "
)
Distinct Cat & Qty Concatenation =
VAR _t =
ADDCOLUMNS (
SUMMARIZE ( 'Table1', [Deal], [Cat], [Cat Qty] ),
"Combine",
[Cat] & " " & [Cat Qty]
)
RETURN
CONCATENATEX ( _t, [Combine], " | " )
Output:
Best Regards,
Jinwei Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hello Jinwei,
Qty works if i swtich the first Table1'[Cat] = EARLIER ( 'Table1'[Cat] to Table1'[Deal] = EARLIER ( 'Table1'[Deal].
Distinct Cat Concatenation also works.
Distinct Cat & Qty Concatenation however seems to work (no error) but runs indefinately and I have to end task (I actually waited 1h on a fairly small dataset, and still no result).
@ChPetru , try new measures like
CALCULATE(SUM(Qty),filter(Table, Table1[Deal]=EARLIER(Table1[Deal])),Table1[Deal])
or
CALCULATE(SUM(Qty),filter(Table, Table1[Deal]=EARLIER(Table1[Deal]) && Table1[Cat] =earlier(Table1[Cat]) ),Table1[Deal])
User | Count |
---|---|
20 | |
8 | |
7 | |
7 | |
6 |
User | Count |
---|---|
28 | |
13 | |
12 | |
9 | |
8 |