Forum Discussion

Chris_noob's avatar
Chris_noob
Frequent Visitor
2 years ago
Solved

Score calculation help, stuck with SUMIF equivalent in Excel

Hi Forum,

 

I'm working on a report to calculate scores and I'm a little bit stuck.

 

My report calculate scores with a weight factor. It's composed of 3 tables Cat, Question and Choices.

I have a relationship on Cat name between Cat and Question and a relationship on Question ID between Question and Choices.

 

I have a Measure to calculate the Min and the Max points that you can get per question. Both take into account the weight. (multiplier)

_MinPQ =
VAR QuestionType = SELECTEDVALUE('Questions'[Weight Type])
VAR Multiplier = SELECTEDVALUE('Questions'[WeightQ])

RETURN
IF(
QuestionType = "Single",
MINX('Choices', 'Choices'[Weight Response]) * Multiplier,
0 * Multiplier
)

_MaxPQ =
VAR QuestionType = SELECTEDVALUE('Questions'[Weight Type])
VAR Multiplier = SELECTEDVALUE(Questions[WeightQ])

RETURN
IF(
QuestionType = "Single",
MAXX('Choices', 'Choices'[Weight Response]) * Multiplier,
SUM('Choices'[Weight Response]) * Multiplier
)

 

Now in a way or another, on top of the question, I would love to have the Min and Max points but for the category and for the total (all)

 

Sample of what I expect:

 

Maybe it's late, I've spend a lot of hours on this, always dificlult when we start 😕

 

Link to a sample file:

https://drive.google.com/file/d/1llvqMNp56MwyCxWNv501GXWIwE52OIgo/view?usp=share_link

 

Thanks in advance for your precious help.

Chris

  • Hi AllisonKennedy 

     

    Thank you very much for your help. I found an option, I added a Matrix, with the calculated columns and summerized using sum and it did the trick 😉

5 Replies

  • Chris_noob's avatar
    Chris_noob
    Frequent Visitor

    Hi AllisonKennedy 

     

    Thank you very much for your help. I found an option, I added a Matrix, with the calculated columns and summerized using sum and it did the trick 😉

    • AllisonKennedy's avatar
      AllisonKennedy
      Icon for Community Champion rankCommunity Champion

      Chris_noob Apologies for not replying over the weekend. Glad you found a solution. Matrix subtotals are fantastic - it's very similar to Pivot Table in Excel if you're familiar with that. 

       

      As per your other question on why it wasn't working - the formulas I provided need to be created as MEASURES not COLUMNS. Not sure if that's what was causing the 0s?

  • AllisonKennedy's avatar
    AllisonKennedy
    Icon for Community Champion rankCommunity Champion

    Chris_noob  

     

    If you're using it in the same visual as your post, you can use:

     

    MinCat = calculate ( [_MinPQ] , ALL( Question[Question] ) )

    MinTotal =  calculate ( [_MinPQ] , ALL(  ) )

     

    and then the same pattern for the Max

    • Chris_noob's avatar
      Chris_noob
      Frequent Visitor

      Thanks AllisonKennedy 

       

      I just tried but unfortunately, unless I'm doing something wrong but it's not fully working as expected 😞

       

      Here's the result:

       

       

  • Chris_noob's avatar
    Chris_noob
    Frequent Visitor

    Hi Forum,

     

    I'm not an expert in Matrix, I tried to play with it and I'm wondering if a Matrix could not in a way or another solve my sub-totals and totals?

    Any advice?

     

    Thanks in advance, wish you all a good weekend.

     

    Chris