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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
JureGa
New Member

Grouping Data with Ponders

Hi Power BI Community,

 

I would like to know if it is possible to create groups in Power BI with ponders for some values, for example I have database of 3 different products (which are in fact the same but with different quantities): 

 

1xProduct 1

5xProduct 1 

50x Product 1

 

I have data for sales and stock and now I woul like to join this in one product. So I need to multiply sales and stock data for product 50x Product 1 with 50 and for prduct 5x Product 1 with 5 and group it in one product.

 

I already tried this with power query modification but the loading time increased too much so I need to delete it. If approach above is not possible I would kindly ask for some other ideas.

 

Thank you,

Jure 

1 ACCEPTED SOLUTION
v-zhenbw-msft
Community Support
Community Support

Hi @JureGa ,

 

We can use the split function to meet your requirement.

 

1. In Editor Query, split the Product column by “x”.

 

Gr1.jpg

 

2. Then we need to group the product.1 and product.2.

 

Gr2.jpg

 

3. At last, we can create a measure to get the result.

 

Measure 2 = 
SUMX('New table',CALCULATE(SUM('New table'[Product.1]))*CALCULATE(SUM('New table'[Sum_quantity])))

 

Gr3.jpg

 

If you have any question, please kindly ask here and we will try to resolve it.

 

Best regards,

 

Community Support Team _ zhenbw

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

 

BTW, pbix as attached.

View solution in original post

5 REPLIES 5
v-zhenbw-msft
Community Support
Community Support

Hi @JureGa ,

 

We can use the split function to meet your requirement.

 

1. In Editor Query, split the Product column by “x”.

 

Gr1.jpg

 

2. Then we need to group the product.1 and product.2.

 

Gr2.jpg

 

3. At last, we can create a measure to get the result.

 

Measure 2 = 
SUMX('New table',CALCULATE(SUM('New table'[Product.1]))*CALCULATE(SUM('New table'[Sum_quantity])))

 

Gr3.jpg

 

If you have any question, please kindly ask here and we will try to resolve it.

 

Best regards,

 

Community Support Team _ zhenbw

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

 

BTW, pbix as attached.

JureGa
New Member

Hi @v-zhenbw-msft, thank you for your reply.

 

You understood what I want to acchieve, result is correct but is it possible to make adjustment of the existing column "Product" and "Quantity". So that you do not create new column but manipulate existing one.

 

Thank you!

Jure 

v-zhenbw-msft
Community Support
Community Support

Hi @JureGa ,

 

We can create a measure to meet your requirement.

 

Measure = 
SUMX(
    SUMMARIZE(
        'Table','Table'[Product],"column1",
        SWITCH(
            TRUE(),
            CONTAINSSTRING(MAX('Table'[Product]),"50x")=TRUE(),SUM('Table'[Quantity])*50,
            CONTAINSSTRING(MAX('Table'[Product]),"5x")=TRUE(),SUM('Table'[Quantity])*5,
            CONTAINSSTRING(MAX('Table'[Product]),"1x")=TRUE(),SUM('Table'[Quantity]))),
    [column1])

 

G1.jpg

 

If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared?

 

Best regards,

 

Community Support Team _ zhenbw

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

 

BTW, pbix as attached.

JureGa
New Member

Hi @amitchandak,

 

my file is really big and has a lot of sensitive data, so maybe I can explain you what I want to acchieve with the tables bellow:

 

1. I have data source like this 

ProductQuantity
1xProduct 11
1xProduct 13
1xProduct 11
5xProduct 12
5xProduct 11
50xProduct 12
1xProduct 12
1xProduct 12
1xProduct 12
50xProduct 12

 

2. When I run Power BI report the following data is shown:

ProductQuantity
1xProduct 111
5xProduct 13
50xProduct 14

 

3. But I want to achieve this:

ProductQuantity
1xProduct 1226

 

Is it understandable?

 

Thank you and BR,

Jure 

amitchandak
Super User
Super User

@JureGa ,Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.