Forum Discussion

Applicable88's avatar
Applicable88
Impactful Individual
5 years ago
Solved

Iterator function with calculate

Hello,

I get different values here:

For example I have a values table with only four different rows (4 distinct dates), Measure 4 returns 23 with that function:

Measure 4 = SUMX(values(Tabelle1[Date]),calculate(count(Tabelle1[MissionID]))) 
vs.
But returns 92:
 Measure 7 = sumx(values(Tabelle1[Date]),count(Tabelle1[MissionID]))
He put the total count in every row and sums it up.
But what does calculate does different here?
Thank you very much in advance. 
Best.
 

 

  • Applicable88 you need to understand context transition and row filter context. Calculate pass the date as row filter context and then calculate the count of mission for that date and then sumx adds all that up which doesn't happen when you are not using calculate.

     

    Check my latest blog post Comparing Selected Client With Other Top N Clients | PeryTUS  I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

    Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.

2 Replies

  • Applicable88 you need to understand context transition and row filter context. Calculate pass the date as row filter context and then calculate the count of mission for that date and then sumx adds all that up which doesn't happen when you are not using calculate.

     

    Check my latest blog post Comparing Selected Client With Other Top N Clients | PeryTUS  I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

    Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.

    • Applicable88's avatar
      Applicable88
      Impactful Individual

      Seemingly I need to learn more about "context transisition". Since I put the count() and calculate(count()) into a table I got the same total. And calculate is not a iterator function per definition on the DaxGuide website. So I was confusing even more. As you can see I wallking in a circle for days also in another thread....