Forum Discussion

Syndicate_Admin's avatar
Syndicate_Admin
Administrator
4 years ago
Solved

Group data with DAX

Hello good morning,

I would like to know if with DAX you can do a grouping of values as you would in Power Query with the grouping itself (I ask this because I can't edit Power Query queries), or if there is some other way to do the following:

I get a table with the data of the promotions of the products where each row is a date and in a field of the table indicates the number of promotions it had, with that I have to put a card that indicates the product that has more promotions considering the criteria that are filtered (there are five segmenters that filter by date, product, etc.), I thought to create a grouping of data possibly in a table created with DAX where I place the codes of the products and the total sum of promotions they had and later with the MAX function get the one with the most promotions, if you could help me by indicating if it is possible or if there is another way to achieve this, the end result should be only a value that is placed on a card.

The data arrives like this;

GerardContlx_0-1641270238274.png

You want to get something similar to this but with DAX.

GerardContlx_1-1641270285276.png

To get the maximum value and present it on a card.

GerardContlx_2-1641270404823.png

With what you can help me I thank you in advance.

  • Syndicate_Admin , a measure like this can help

    maxx(summarize(Table, Table[mater_product_id], "_sum", sum(Table[num_promos])), [_sum])

     

    You can create a table if needed using summarize or summarizecolumns

     

    summarize(Table, Table[mater_product_id], "_sum", sum(Table[num_promos]))

2 Replies

  • Syndicate_Admin , a measure like this can help

    maxx(summarize(Table, Table[mater_product_id], "_sum", sum(Table[num_promos])), [_sum])

     

    You can create a table if needed using summarize or summarizecolumns

     

    summarize(Table, Table[mater_product_id], "_sum", sum(Table[num_promos]))

    • Syndicate_Admin's avatar
      Syndicate_Admin
      Administrator

      I thank you for your answer, sorry if the question is very basic but I am very new, one more doubt I would have is if that calculation is affected by a date slicer.