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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
krishak77
Helper I
Helper I

DAX formula not working

Hello Everyone,

 

Can anyone help me to fix the below formula?

 

For the below excel formula, i having created measure as below, but it is not working for me.

=IF(AND(D2<0.9,D3>=0.9),A2+(A3-A2)*(0.9-D2)/(D3-D2),0) and it should continue till last row.
 
Row LabelsCount of SotatCount of Sotat2FR_PerFill Rate 90
0896573.96%73.96%0
110358.54%82.49%0
28607.09%89.59%2.076497696
36515.37%94.96%0
41291.06%96.02%0
5770.64%96.66%0
6620.51%97.17%0
71150.95%98.12%0
8400.33%98.45%0
9340.28%98.73%0
10460.38%99.11%0
11110.09%99.20%0
12140.12%99.32%0
13220.18%99.50%0
14230.19%99.69%0
15110.09%99.78%0
2030.02%99.80%0
21130.11%99.91%0
2940.03%99.94%0
3010.01%99.95%0
3310.01%99.96%0
4130.02%99.98%0
5220.02%100.00%0
These are measures 'SOTAT Analysis'[A_rownumber] , SOTAT Analysis'[Com_SOTAT] and SOTAT Analysis'[A_SOTAT]
and This is having column SOTAT Analysis'[SOTAT]
 
A_FR_SOTAT = VAR CurrentRow = 'SOTAT Analysis'[A_rownumber] // Replace 'YourTable' with the actual name of your table and 'Index' with your table's index column
 
VAR PreviousRowVD = CALCULATE(MAXX('SOTAT Analysis','SOTAT Analysis'[Com_SOTAT]), FILTER('SOTAT Analysis', 'SOTAT Analysis'[SOTAT] = CurrentRow + 1))
VAR PreviousRowA = CALCULATE(MAX('SOTAT Analysis'[Sotat]), FILTER('SOTAT Analysis', 'SOTAT Analysis'[SOTAT] = CurrentRow + 1))
VAR currentRowVD = CALCULATE(MAXX('SOTAT Analysis','SOTAT Analysis'[Com_SOTAT]), FILTER('SOTAT Analysis', 'SOTAT Analysis'[SOTAT] = CurrentRow))
VAR currentRowA = CALCULATE(MAX('SOTAT Analysis'[Sotat]), FILTER('SOTAT Analysis', 'SOTAT Analysis'[SOTAT] = CurrentRow))
 
RETURN
 
IF(CurrentRow >=1 && currentRowVD < 0.9 && PreviousRowVD >= 0.9, currentRowA + (PreviousRowA - currentRowA) * (0.9 - (currentRowVD)) / (PreviousRowVD - (currentRowVD)),0
)
4 REPLIES 4
Anonymous
Not applicable

Hi @krishak77,

You can try to use the following measure formula if it suitable for your requirement:

A_FR_SOTAT =
VAR CurrentRow =
    MAX ( 'SOTAT Analysis'[Row Labels] )
VAR nextRowVD =
    CALCULATE (
        MAX ( 'SOTAT Analysis'[Com_SOTAT] ),
        FILTER (
            ALLSELECTED ( 'SOTAT Analysis' ),
            'SOTAT Analysis'[SOTAT] = CurrentRow + 1
        )
    )
VAR nextRowA =
    CALCULATE (
        MAX ( 'SOTAT Analysis'[Sotat] ),
        FILTER (
            ALLSELECTED ( 'SOTAT Analysis' ),
            'SOTAT Analysis'[SOTAT] = CurrentRow + 1
        )
    )
VAR currentRowVD =
    CALCULATE (
        MAX ( 'SOTAT Analysis'[Com_SOTAT] ),
        FILTER (
            ALLSELECTED ( 'SOTAT Analysis' ),
            'SOTAT Analysis'[SOTAT] = CurrentRow
        )
    )
VAR currentRowA =
    CALCULATE (
        MAX ( 'SOTAT Analysis'[Sotat] ),
        FILTER (
            ALLSELECTED ( 'SOTAT Analysis' ),
            'SOTAT Analysis'[SOTAT] = CurrentRow
        )
    )
RETURN
    IF (
        currentRowVD < 0.9
            && nextRowVD >= 0.9,
        currentRowA
            + ( nextRowA - currentRowA )
                * DIVIDE ( 0.9 - currentRowVD, nextRowVD - currentRowVD ),
        0
    )

Regards,

Xiaoxin Sheng

Hello @Anonymous ,

 

Thanks for your effort and support.

 

this code is not working as expected, it is returning as 1 for each row, another Var is working as expected.

As we have percentage in the measure Com_SOTAT, it is coming as roundup with 1 i guess.

Is it possible to get exact percentage value in number?

VAR nextRowVD =
    CALCULATE (
        MAX ( 'SOTAT Analysis'[Com_SOTAT] ),
        FILTER (
            ALLSELECTED ( 'SOTAT Analysis' ),
            'SOTAT Analysis'[SOTAT] = CurrentRow + 1
        )
    )

 

 

Anonymous
Not applicable

HI @krishak77,

AFAIK, the max function does not include round features, they should base on the table field data type definitions.

What data type that you defined on the ‘Com_SOTAT’ filed? Can you please share some dummy data to test?

How to Get Your Question Answered Quickly  

Regards,

Xiaoxin Sheng

Hello @Anonymous 

 

Issue is solved, but really appreciate your support.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.