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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
sentsara
Helper II
Helper II

DAX Expression for comparing rows

 

Hi ,

I need help on "Rate Level Current" DAX Expression to built.

 

Requirement:

Step:1 Take "current Forecast" Percentage value by applying filter on currrent "PM" Value 

step:2 check under which "Scenario Rate" its falling and map the minium "Rate Level Value". 

 

Pseudo logic:

IF Current Forecast > Scenario Rate then 1
IF CUrrent Forecast between Scenario Rate then take MIN of "RateLevel"
IF Current Forecast < Scenaro Rate then 9

 

below is dataset and i need to Write DAX Expression for " Rate Level Current". can you please help on this?

PMRate LevelScenario RateCurrent ForecastRate Level Current
CH_ABC167.52%62.94%6
CH_ABC266.05%62.94%6
CH_ABC365.51%62.94%6
CH_ABC464.47%62.94%6
CH_ABC564.46%62.94%6
CH_ABC661.52%62.94%6
CH_ABC759.51%62.94%6
CH_ABC857.66%62.94%6
CH_ABC90.00%62.94%6
CH_GDB191.93%86.88%4
CH_GDB289.40%86.88%4
CH_GDB389.28%86.88%4
CH_GDB485.27%86.88%4
CH_GDB584.25%86.88%4
CH_GDB677.28%86.88%4
CH_GDB777.27%86.88%4
CH_GDB876.23%86.88%4
CH_GDB90.00%86.88%4

 

1 ACCEPTED SOLUTION
TomMartens
Super User
Super User

Hey,

 

I used this DAX statement to create a calculated column:

calc Rate Level Current = 
var currentPM = 'Table1'[PM]
var currentForecast = 'Table1'[Current Forecast]
var smallerScenarioRate =
CALCULATE(
    MAX('Table1'[Scenario Rate])
    ,FILTER(
        ALL('Table1')
        ,'Table1'[PM] = currentPM && 'Table1'[Scenario Rate] < currentForecast
    )
)
return
CALCULATE(
    MAX('Table1'[Rate Level])
    ,FILTER(
        ALL('Table1')
        ,'Table1'[PM] = currentPM && 'Table1'[Scenario Rate] = smallerScenarioRate
    )
)

This returns these values:

image.png

 

And here is a small PBIX file

 

Hopefully this is what you are looking for.

 

Regards

Tom

 

 

 

 



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

2 REPLIES 2
TomMartens
Super User
Super User

Hey,

 

I used this DAX statement to create a calculated column:

calc Rate Level Current = 
var currentPM = 'Table1'[PM]
var currentForecast = 'Table1'[Current Forecast]
var smallerScenarioRate =
CALCULATE(
    MAX('Table1'[Scenario Rate])
    ,FILTER(
        ALL('Table1')
        ,'Table1'[PM] = currentPM && 'Table1'[Scenario Rate] < currentForecast
    )
)
return
CALCULATE(
    MAX('Table1'[Rate Level])
    ,FILTER(
        ALL('Table1')
        ,'Table1'[PM] = currentPM && 'Table1'[Scenario Rate] = smallerScenarioRate
    )
)

This returns these values:

image.png

 

And here is a small PBIX file

 

Hopefully this is what you are looking for.

 

Regards

Tom

 

 

 

 



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Hi Tom,

Thanks for taking time and provided with good example. i forgot to say one more thing. Current Forecast is the calculated column which is defined in another Dataset.i think thats the reason circular dependency was detected error is thrown.

 

 

I'm getting error as : "Circular Dependency was detected:"

 

calc Rate Level Current =
var currentPM = 'Table1'[PM]
var currentForecast = 'Table1'[Current Forecast] -- it comes from QRI DATASET --UNDER QRI Dataset it has derived as caculated column


var smallerScenarioRate =
CALCULATE(
MAX('Table1'[Scenario Rate])
,FILTER(
ALL('Table1')
,'Table1'[PM] = currentPM && 'Table1'[Scenario Rate] < currentForecast
)
)
return
CALCULATE(
MAX('Table1'[Rate Level])
,FILTER(
ALL('Table1')
,'Table1'[PM] = currentPM && 'Table1'[Scenario Rate] = smallerScenarioRate
)
)

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.