cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
DavidGolden
Frequent Visitor

values from Order_By column within Summar table

Hi,

I used summarize in the (sales) table, and grouped by columns [Cod] and [Sec], being the summary expressión "prima" a simple sum. The virtual summarized table would look like this.

Cod

Sec

prima

1542

1

$1.425,75

1542

4

$2.722,30

1724

3

$2.524,11

1724

8

$241,00

 

Now, from this virtual summarized table,  I need the get the values of [Sec] colum for the max (prima) for each [Cod], that woul be "SecOfMaxPrima". The returned value would a table containing at least  columns [Cod] and [SecOfMaxPrima]  

 

In this example, returned values should be 

 

Cod

Sec

1542

4

1724

3

 

I failed at using lookupvalue for this, since it doesn´t recognize the virtual summary table. I failed also at summarizing the summarized table (can you do that?)

 

Would you please help me solve this. Thanks!

1 ACCEPTED SOLUTION

Hi @DavidGolden,

Did you mean the sample table that you shared has been summarized already? If that is the case, you can try to use the following formulas to create a new table if it is suitable for your requirement:

NewTable =
VAR summary =
    SUMMARIZE ( 'Table', [Cod], [Sec], "s_prima", SUM ( 'Table'[prima] ) )
VAR mPrima =
    GROUPBY ( summary, [Cod], "prima", MAXX ( CURRENTGROUP (), [s_prima] ) )
RETURN
    FILTER ( summary, [s_prima] IN SELECTCOLUMNS ( mPrima, "prima", [prima] ) )

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

4 REPLIES 4
ValtteriN
Super User
Super User

Hi,

Here is one way to do this:

Table 7 = SUMMARIZE(SecCod,SecCod[cod],"sec",
CALCULATE(MAX(SecCod[sec]),ALLEXCEPT(SecCod,SecCod[cod]),SecCod[prima]=MAX(SecCod[prima])))
Example:

ValtteriN_0-1643724925401.png

I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Thnaks @ValtteriN , can I do that within a virtual table taht has been already summarized?

I mean, the 'SecCod' table you suggest is actually a returned table from summarize function, I tryed your suggestion, but it didnt worked. Am I missing something?

Hi @DavidGolden,

Did you mean the sample table that you shared has been summarized already? If that is the case, you can try to use the following formulas to create a new table if it is suitable for your requirement:

NewTable =
VAR summary =
    SUMMARIZE ( 'Table', [Cod], [Sec], "s_prima", SUM ( 'Table'[prima] ) )
VAR mPrima =
    GROUPBY ( summary, [Cod], "prima", MAXX ( CURRENTGROUP (), [s_prima] ) )
RETURN
    FILTER ( summary, [s_prima] IN SELECTCOLUMNS ( mPrima, "prima", [prima] ) )

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Hi,

You can place your previous DAX within a variable and summarize it. Do you want to have your end result as a measure or as a table? I am not sure I understood your goal correctly.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
June 2022 update 768X460.jpg

Check it out!

Click here to read more about the June 2022 updates!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power BI Dev Camp Session 23 768x460.jpg

Check it Out!

Mark your calendars and join us on Thursday, June 30 at 11a PDT for a great session with Ted Pattison!

June 20 episode 7 with aka link 768x460.jpg

The Power BI Community Show

Join us on June 20 at 11 am PDT when Kim Manis shares the latest on Azure Synapse analytics, the Microsoft Intelligent Data Platform, and notable Power BI Updates from Microsoft Build 2022.

Top Solution Authors
Top Kudoed Authors