Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

DAX, joining a table with itself

Hi

I have a DAX problem, which I simplified. See link to pbix
The Facts table has multiple rows per date per product. First I have to group on product and date. And then I have to get the two distinct products with the max(number). I also have to have the date for that max(number).
So the outcome must be:

  • product CC, date 3-1-2020 , number 890 and
  • product BB, date 1-1-2020 , number 640

‘Sum per products per day’ is summing the products on day level.
‘Max 2 products’ should give me the two products, but got stuck.
Can somebody help?

 

https://www.dropbox.com/scl/fi/ls56zi36jks1h2v9ufl4q/testa.pbix?rlkey=ukpbic4d2i1gtxlsdely857uf&dl=0 

 

Regards Ron

Greg_Deckler even your fantastic DAX for Humans serie couldn't help me in this one 😞

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Thnx tamerj1 

    Wow, that looks really difficult. A calculate in a calculate.
    It works and thnx for that, but for me hard to understand.

    Can I order or rank them? I tried adding 'ORDER BY [@Sum] DESC' but that doesn't work.

    • tamerj1's avatar
      tamerj1
      Community Champion

      Anonymous 
      ORDER BY does not work in this case. Just sort the [@Sum] column