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

Don'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.

Reply
GAPER
Post Patron
Post Patron

How to aggregrate data with multiple tagging

I have a table like this

 

GAPER_0-1722822546867.png

 

Beucase you can see one project can be tagged to multiple strategy so when we aggregrate the data it could become something like this 

 

GAPER_1-1722822686274.png

 

I have though of using multiple ways to create the "cash flow cleaned" for exmaple dividing the sum of CF by the count of strategy. But it doesn work on the overall basis. 

 

May I know how do you handle that? Thanks. 

 

2 ACCEPTED SOLUTIONS
Ritaf1983
Super User
Super User

Hi @GAPER 
You can add an index column by project level using the linked method:
https://radacad.com/create-row-number-for-each-group-in-power-bi-using-power-query

and after you'll get the table like :

Ritaf1983_0-1722823789566.png

you can create a simple measure for summarizing only the first row of every project:

Cf_ = CALCULATE(sum('Table'[Cf]),'Table'[Index]=1)
Result :
Ritaf1983_1-1722823856884.png

The pbix is attached

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

View solution in original post

Hi @GAPER 
1. You need to merge the tables to get 1.
Please check this guide :
https://www.youtube.com/watch?v=m4feUpoDpVI

2. According to the index it is not a part of UI.
you have to create it. I gave the link to the guide in my first response :
https://radacad.com/create-row-number-for-each-group-in-power-bi-using-power-query

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

 

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

View solution in original post

10 REPLIES 10
GAPER
Post Patron
Post Patron

The problem is that I can't merge them into one single table because it will blow up the table size. 

GAPER
Post Patron
Post Patron

Works like a charm. Thanks RITA!

Happy to help 🙂

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile
GAPER
Post Patron
Post Patron

Thanks Rita - I tried it works on the aggregration level but if i use strategy as a filter. It doesn't know how to dynamically change the index (for example project abc should also be appreaing there) Is there a way we can dynamically make the index according to the strategy?

GAPER_0-1722824471367.png

GAPER_1-1722824489132.png

 

Hi @GAPER 
Update the formula to :

Cf_ =
if(HASONEFILTER('Table'[Strategy]),
SUMX( SUMMARIZE('Table','Table'[Project],"Max strategy",max('Table'[Strategy]),"CF",sum('Table'[Cf])),[CF]),
CALCULATE(sum('Table'[Cf]),'Table'[Index]=1)
 )
Results:
Ritaf1983_0-1722825249607.pngRitaf1983_1-1722825268227.pngRitaf1983_2-1722825341066.png

Modified PBIX is attached

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile
Ritaf1983
Super User
Super User

Hi @GAPER 
You can add an index column by project level using the linked method:
https://radacad.com/create-row-number-for-each-group-in-power-bi-using-power-query

and after you'll get the table like :

Ritaf1983_0-1722823789566.png

you can create a simple measure for summarizing only the first row of every project:

Cf_ = CALCULATE(sum('Table'[Cf]),'Table'[Index]=1)
Result :
Ritaf1983_1-1722823856884.png

The pbix is attached

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Hi Rita - i have one follow up. Now the data doesn't sit within one single table. It's like this

 

GAPER_0-1722829891986.pngGAPER_1-1722829898844.png

 

Would you be able to show me how would you do it now? Thank you.

 

Also i am not able to find the add index in the PowerBI UI. Could you show me? Thanks

 

Hi @GAPER 
1. You need to merge the tables to get 1.
Please check this guide :
https://www.youtube.com/watch?v=m4feUpoDpVI

2. According to the index it is not a part of UI.
you have to create it. I gave the link to the guide in my first response :
https://radacad.com/create-row-number-for-each-group-in-power-bi-using-power-query

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

 

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

GAPER_0-1723456648292.pngGAPER_1-1723456665234.pngGAPER_2-1723456673348.pngGAPER_3-1723456686020.png

As you can see. If i pick all strategy, it's correct, if i pick X, Y, Z individually it's correct. However when I pick y&z it's giving me the wrong result. Thanks

 

Underlying excel

 

DateProjectStrategyCF1CF2Index
01/01/2024Ax100-1001
02/01/2024Ax -2001
03/01/2024Ax200-3001
01/01/2024Ay100-1002
02/01/2024Ay -2002
03/01/2024Ay200-3002
01/01/2024Az100-1003
02/01/2024Az -2003
03/01/2024Az200-3003
01/01/2024Bx100-1001
02/01/2024Bx200-2001
03/01/2024Bx200-3001
01/01/2024By100-1002
02/01/2024By200-2002
03/01/2024By200-3002
01/01/2024cZ1004001
02/01/2024cZ1004001
03/01/2024cZ1004001

 

 

my cashflow formula. 

 

00.cashflow =
if(HASONEFILTER('Sheet1'[Strategy]),
SUMX( SUMMARIZE('Sheet1','Sheet1'[Project],"Max strategy",max('Sheet1'[Strategy]),"CF1",sum('Sheet1'[CF1])),[CF1]),
CALCULATE(sum('Sheet1'[CF1]),'Sheet1'[Index]=1)
 )

 

Thanks

Hi @GAPER 

I apologize, but with all the scrolling through the images, I’m having trouble understanding what you were trying to achieve and what you’ve done. The only thing I noticed is that the index doesn’t seem to be done correctly. I suggest creating a file with an example and the desired result, and including a link to it—perhaps even in a new, clean post

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.