Forum Discussion

Jaxon's avatar
Jaxon
Frequent Visitor
8 years ago

DAX Code | IF statements to help dynamically calculate a score

Edited to try an accomodate the suggestion I asked this wrong.... I'm trying. Hope this helped?

 

First - Forgive me if there is a better way to say this for you DAX pro's...I am looking for guidance if this can be done and if so - what conditional statement I could/should use:

 

3 Data Sources: Report_One, Report_Two, Report_Three

Each Looking Fairly Similar as this example:

 

We calculate Scores on each like this in a measures table where we keep all measures:

Note Score_One, Score_Two, Score_Three comes from a different data source. (Can't be merged due to other data needs inside)

Score_One =
DIVIDE (
    SUM ( Report_One[Yes] ),
    ( SUM ( Report_One[Yes] ) + SUM ( Report_One[No] ) )
)


Score_Two =
DIVIDE (
    SUM ( Report_Two[Yes] ),
    ( SUM ( Report_Two[Yes] ) + SUM ( Report_Two[No] ) )
)


Score_Three =
DIVIDE (
    SUM ( Report_Three[Yes] ),
    ( SUM ( Report_Three[Yes] ) + SUM ( Report_Three[No] ) )
)

 

 

Then we have a measure to calculate the overall score of the 3 reports such as:

OVERALL SCORE = 
 (
    CALCULATE (
        ( 'A1_Measures Table'[Score_One] * ( .33 )
            + ( ( 'A1_Measures Table'[Score_Two] ) * ( .33 )
            + ( 'A1_Measures Table'[Score_Three] ) * ( .33 ) ) )
    )
)

 

 

Business Problem

Sometimes on 1,2 or all 3 data sources we may not have data for an agent. (see example, Betty Rubble)

In this case I do not want to calculate the same way or it brings down the score unfairly.

So I would like to then adjust to accomodate those scenarios.

 

I assume I need and IF statement of some sort to adjust that says If No Data for a person in Report One, Two, or Three then Calculate like x,y,z...no data in all 3 can show (blank)

 

If no data for a paticular person in a report then calculate the Overall Score on the remaining two both scores at  .5, If no data for a particular person in two reports then calculate the Overall Score on the remaining report score at  1.0

 

Can this be done?

Best Way To Accomplish?

3 Replies