Reply
dindardiniho
Regular Visitor
Partially syndicated - Outbound

Comparison of column with parameter value and output status

Hello everyone,

I'm facing a problem and just don't know what to do.

I have a Power BI report which accesses an Azure SQL database via direct query, the table contains some columns with date and time values.

 

In this case, the columns "Idle_duration" and the column "process_status" are the most relevant.

The "Idle_duration" returns an integer value which counts up how long an item is in a certain status.

For example, the "process_status" is "BEAUFTRAG" and the "idle_duration" is 59 minutes.

 

I would now like to offer the user the option of specifying limit values for "in time" = 1, "urgent"=  2, "critical" = 3.
My first approach was to specify input fields for parameters and use DAX to create a column that compares the parameter values with the current "idle_duration" and outputs 1, 2 or 3 accordingly.


However, this did not work, although the measure theoretically does not show any errors, the comparison of the "idl_duration" column with the parameters does not take place, no matter what value I enter in the parameter fields.


Would anyone here in the forum know a better way to solve this without significantly increasing the loading times?
Thanks in advance!


Data:

dindardiniho_0-1707821454602.png

 

Field parameters:

dindardiniho_5-1707821882064.png

 

 

Used DAX Measure to create a column with values from 1-3 depeding on the time in the column "idle_duration":

dindardiniho_4-1707821822492.png

 


Modeling Mapping table "Status" and new column "Status_WA":

dindardiniho_6-1707822354430.png

dindardiniho_7-1707822379122.png

 

 

1 ACCEPTED SOLUTION
v-xinruzhu-msft
Community Support
Community Support

Syndicated - Outbound

Hi @dindardiniho 

Your paramater is dynamical, but the calculated column is static, so you need to create a measue instead of calculated column

e.g You want to calculated the counts of the related status_Nr

 

Counts =
VAR par1 =
    MAX ( '1_Paramater'[Paramater Wert] )
VAR par2 =
    MAX ( '2_Paramater'[2_Paramater Wert] )
VAR _add =
    ADDCOLUMNS (
        receivinr_order,
        "statusno",
            SWITCH (
                TRUE (),
                [idle_duration] <= par1, 1,
                [idle_duration] > par1
                    && [idle_duration] <= par2, 2,
                [idle_duration] > par2, 3
            )
    )
RETURN
    COUNTROWS ( FILTER ( _add, [statusno] IN VALUES ( 'Status'[Stat.Nr] ) ) )

 

 

 

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

1 REPLY 1
v-xinruzhu-msft
Community Support
Community Support

Syndicated - Outbound

Hi @dindardiniho 

Your paramater is dynamical, but the calculated column is static, so you need to create a measue instead of calculated column

e.g You want to calculated the counts of the related status_Nr

 

Counts =
VAR par1 =
    MAX ( '1_Paramater'[Paramater Wert] )
VAR par2 =
    MAX ( '2_Paramater'[2_Paramater Wert] )
VAR _add =
    ADDCOLUMNS (
        receivinr_order,
        "statusno",
            SWITCH (
                TRUE (),
                [idle_duration] <= par1, 1,
                [idle_duration] > par1
                    && [idle_duration] <= par2, 2,
                [idle_duration] > par2, 3
            )
    )
RETURN
    COUNTROWS ( FILTER ( _add, [statusno] IN VALUES ( 'Status'[Stat.Nr] ) ) )

 

 

 

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

avatar user

Helpful resources

Announcements
March PBI video - carousel

Power BI Monthly Update - March 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors (Last Month)
Top Kudoed Authors (Last Month)