Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
MonkeySam
Frequent Visitor

Looking for DAX doing conditional calculation

Hi All,

I am looking for one or two meaures to do conditional calculation(s) instead of building up separate measures.

 

It's about sort of scoring but requires further conversion per metric criteria and consolidate per the given weight. Below screenshot you can see M01 is given a special conversion than others:

Requests:

1. Is it possible to add conditions within "True Score %" measure and returns the result as "Converted Score %"? What I am looking for is this measure would reflect the average of "Converted Score %" when there is no any filter applied. For example, displying in a Card visualization.

 

2. Similar to above, is it possible to do one measure with Weight conversion per Metric ID?

 

Example Metrics.jpg

 

My example PBIX file

 

 

1 ACCEPTED SOLUTION
DataInsights
Super User
Super User

@MonkeySam,

 

Try these measures. I added a Weight column to your table.

 

Converted Score % = 
VAR vTable =
    ADDCOLUMNS ( VALUES ( 'Dataset'[Metric ID] ), "@TrueScore", [True Score %] )
VAR vResult =
    AVERAGEX ( vTable, IF ( 'Dataset'[Metric ID] = "M01", 1, [@TrueScore] ) )
RETURN
    vResult

Weighted Score % =
VAR vTable =
    ADDCOLUMNS (
        VALUES ( 'Dataset'[Metric ID] ),
        "@ConvertedScore", [Converted Score %],
        "@Weight", CALCULATE ( MAX ( 'Dataset'[Weight] ) )
    )
VAR vResult =
    SUMX ( vTable, [@ConvertedScore] * [@Weight] )
RETURN
    vResult

 

DataInsights_0-1619203492697.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

3 REPLIES 3
DataInsights
Super User
Super User

@MonkeySam,

 

Try these measures. I added a Weight column to your table.

 

Converted Score % = 
VAR vTable =
    ADDCOLUMNS ( VALUES ( 'Dataset'[Metric ID] ), "@TrueScore", [True Score %] )
VAR vResult =
    AVERAGEX ( vTable, IF ( 'Dataset'[Metric ID] = "M01", 1, [@TrueScore] ) )
RETURN
    vResult

Weighted Score % =
VAR vTable =
    ADDCOLUMNS (
        VALUES ( 'Dataset'[Metric ID] ),
        "@ConvertedScore", [Converted Score %],
        "@Weight", CALCULATE ( MAX ( 'Dataset'[Weight] ) )
    )
VAR vResult =
    SUMX ( vTable, [@ConvertedScore] * [@Weight] )
RETURN
    vResult

 

DataInsights_0-1619203492697.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




@DataInsights,

Many thanks for your support. Your DAX calculations hit the goal!! Just let you know that I added a small condition on "Converted Score %" in order to achieve M1's scenarios.

 

Converted Score % =
VAR vTable =
    ADDCOLUMNS ( VALUES ( 'Dataset'[Metric ID] ), "@TrueScore", [True Score %] )
VAR vResult =
    //AVERAGEX ( vTable, IF ( 'Dataset'[Metric ID] = "M01", 1, [@TrueScore] ) )
    AVERAGEX (
        vTable,
        IF ( 'Dataset'[Metric ID] = "M01" && [@TrueScore] >= 0.5, 1, [@TrueScore] )
    )
RETURN
    vResult

 

Example Metrics 2.jpg

 

 

@MonkeySam,

 

Glad to hear the DAX works. Yes, I see that dual criteria now for M01. 🙂





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.