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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
azertyuiop123
Regular Visitor

Choose aggregation for table Columns

Hello guys,

 

I am new in Power Bi and I would like to create a table in which we would have measures (turnover, expenses ... etc) whose level of aggregation can be chosen, maybe in a segment, by the person consulting my report.

 

For example :

 

We have this data table, 

 

Col1      |    Col2       |   Measure

A           |    a            |    1

A           |    b            |    2

B           |    a            |    3

B           |    B            |    4

 

and a segment with the values "Col1" and "Col2". If "Col1" is selected, the table would be :

Col1      |   Measure (sum)

A           |    3

B           |    7

 

If "Col2" is selected, the table would be :

 

 Col2       |   Measure (sum)

 a            |    4

 b            |    6

 

I don't know if it is very clear but I didn't find any subjets that come close to it.

Can someone tell me if this is possible?

 

Thanks.

 

Emilie

6 REPLIES 6
amitchandak
Super User
Super User

With your example, it seems like you want to group data by various parameters/fields by aggregating some field/measure.

That is what happens in most of the visuals.  You just need drag visual to correct position.

Screenshot 2019-09-16 22.45.25.png

Hello @amitchandak 

 

Thank you for your response, but it is not what i am looking for :'( unfortunatly, non of these subjects help me for what i want to do, maybe it's impossible on Power BI.

 

I always available if someone has an advice.

 

Emilie

Hello,

 

Thank you for your response, it is not exactly what I want. I would like users of my power bi in power bi server to choose the level of aggregation they want. Lika that : (I used 2 data tables separately for the segments et the tables)

If a user chooses non of the columns, the measure will be totally aggregated (sum for example). If he chooses col1 or col2, it will be semi aggregated (sum by col1 or col2 respectively for example). If he chooses col1 and col2, it will be totally disaggregated.

 

 

Can you tell me if it is possible?

Thank you very much.

 

Emilie

Hello,

 

I found a "solution". I think it is not at all good practices but it is the only way I found.

I duplicated the rows like this :

Col1Col2measure
Ad1
Ae2
Bd3
Be4
Cd5
Ce6

 ->

Col1Col2chosencol1chosencol2measure
Adcol1col21
Adcol2col11
Aecol1col22
Aecol2col12
Bdcol1col23
Bdcol2col13
Becol1col24
Becol2col14
Cdcol1col25
Cdcol2col15
Cecol1col26
Cecol2col16
Adcol1col11
Adcol2col21
Aecol1col12
Aecol2col22
Bdcol1col13
Bdcol2col23
Becol1col14
Becol2col24
Cdcol1col15
Cdcol2col25
Cecol1col16
Cecol2col26

 

then I put chosencol1 and chosencol2 in 2 segments, I created 3 columns:

* Colonne1 = if(Table3[chosencol1]="col1", Table3[Col1], if(Table3[chosencol1]="col2", Table3[Col2], BLANK()))
* Colonne2 = if(Table3[chosencol2]="col1", Table3[Col1], if(Table3[chosencol2]="col2", Table3[Col2], BLANK()))
colonnetest = CALCULATE(MAX(Table3[measure]), ALLEXCEPT(Table3, Table3[Col1], Table3[Col2]))
 
then I created a table with the 3 new columns to obtain this :
 
Does someone know another way (more tidy) to do it?
 
Thank you so much. 
 
Emilie

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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