SUM MAX VALUE BASED ON 2 CONDITIONS

  • SUM MAX VALUE BASED ON 2 CONDITIONS

    Posted by DSC Communities on November 21, 2019 at 4:36 pm
    • Christian ArltX

      Member

      November 21, 2019 at 4:36 PM

      I need a measure that sums all the max value_Ā  per (group_) per (timestamp_) where type_ = “DailyActiveSubscriptionCount” && timestamp_ = Today()

      Table = Statistic
      Columns = type_, timestamp_, value_, group_
      Notes = some group_ have multiple entries for the same timestamp_ with different value_ amountsĀ Ā 

      ——————————
      Beau Arlt
      Business Analyst
      Holland MI
      989-400-7812
      ——————————

    • Hasham Niaz

      Member

      November 21, 2019 at 7:38 PM

      Hi Beau !

      Please try following DAX;

      MaxSubscription = 
      VAR MaxDate = TODAY()
      
      RETURN
          CALCULATE (
              SUM(Statistic[value_]),
              FILTER (
                  ALLEXCEPT (Statistic, Statistic[group_], Statistic[timestamp_]),
                  Statistic[type_] = "DailyActiveSubscriptionCount" && Statistic[timestamp_] = MaxDate )
          )

      This will SUM [value_] based per [group_] & [timestamp_] WHERE [type_] = “” AND [timestamp_] = TODAY()

      Regards,

      ——————————
      Hasham Bin Niaz
      Director Data & Analytics
      Karachi, Pakistan
      ——————————
      ——————————————-

    • Christian ArltX

      Member

      November 22, 2019 at 9:55 AM

      I need it to sum the max value. Let me know if you know how to do that as some days have multiple entries for the same group_

      ——————————
      Beau Arlt
      Business Analyst
      Holland MI
      989-400-7812
      ——————————
      ——————————————-

    • Christian ArltX

      Member

      November 22, 2019 at 11:17 AM

      I figured out a solution

      TotalSubs7DaysAgo:=CALCULATE(SUMX(VALUES(Statistic[group_] ),CALCULATE( MAX(Statistic[value_]))),filter(Statistic,Statistic[type_] = “DailyActiveSubscriptionCount” && Statistic[Short Date] = TODAY()-7))

      ——————————
      Beau Arlt
      Business Analyst
      Holland MI
      989-400-7812
      ——————————
      ——————————————-

    • Hasham Niaz

      Member

      November 22, 2019 at 6:36 PM

      Nice, you get the idea of how to get MAX value per group than you can SUM those up.

      Regards,

      ——————————
      Hasham Bin Niaz
      Director Data & Analytics
      Karachi, Pakistan
      ——————————
      ——————————————-

    DSC Communities replied 6 years, 4 months ago 1 Member · 0 Replies
  • 0 Replies

Sorry, there were no replies found.

The discussion ‘SUM MAX VALUE BASED ON 2 CONDITIONS’ is closed to new replies.

Start of Discussion
0 of 0 replies June 2018
Now

Welcome to our new site!

Here you will find a wealth of information created for peopleĀ  that are on a mission to redefine business models with cloud techinologies, AI, automation, low code / no code applications, data, security & more to compete in the Acceleration Economy!