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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Lookup Range of values

My data model:
2019-02-26 16_46_08-SLR_v0.3 - Power BI Desktop (January 2019).png

 

CONF_STATUS_FLOW contains Jira status' sequence, example for specific Jira project:
2019-02-26 16_52_48-SLR_v0.3 - Power BI Desktop (January 2019).png

As an input parameters I have:
- From Status: "Epic: in fast scan" (sequence: 3 in CONF_STATUS_FLOW)
- To Status: "Epic: in progress" (sequence: 7 in CONF_STATUS_FLOW)

Challenges:
1) Get range of eligible sequences from CONF_STATUS_FLOW, based on STG_JIRA_ISSUE values from [Project Key], [Issue Type].
As a result for [Issue Type] = "Epic", it would be {3, 4, 5, 6, 7} for specific Project in Jira.
2) Based on Sequence range {3, 4, 5, 6, 7} find eligible records in STG_JIRA_STATUS table and identify if [StatusID] = XXXX is within this range or not by returning StatusID.
3) Do all this in DAX measure.

Current Code, which is very slow (takes couple of minutes):

Test_Measure :=
    VAR status_id_field =
        FIRSTNONBLANK ( STG_JIRA_STATUS[StatusID], MIN ( STG_JIRA_STATUS[StatusID] ) )
    VAR bss_project_value =
        FIRSTNONBLANK (
            STG_JIRA_ISSUE[Project Key],
            MIN ( STG_JIRA_ISSUE[Project Key] )
        )
    VAR bss_from_status_value = "Epic: in fast scan"
    VAR bss_to_status_value = "Epic: in progress"
    VAR bss_issue_type = "Epic"
    VAR bss_from_status_seq =
        CALCULATE (
            VALUES ( CONF_STATUS_FLOW[Sequence] ),
            CONF_STATUS_FLOW[Project Key] = bss_project_value,
            CONF_STATUS_FLOW[Issue Type] = bss_issue_type,
            CONF_STATUS_FLOW[Status] = bss_from_status_value
        )
    VAR bss_to_status_seq =
        CALCULATE (
            VALUES ( CONF_STATUS_FLOW[Sequence] ),
            CONF_STATUS_FLOW[Project Key] = bss_project_value,
            CONF_STATUS_FLOW[Issue Type] = bss_issue_type,
            CONF_STATUS_FLOW[Status] = bss_to_status_value
        )
    VAR bss_status_value =
        CALCULATETABLE (
            VALUES ( STG_JIRA_STATUS[StatusID] ),
            STG_JIRA_STATUS[Status Sequence] >= bss_from_status_seq,
            STG_JIRA_STATUS[Status Sequence] <= bss_to_status_seq
        )
    RETURN
        SWITCH ( TRUE (), status_id_field IN bss_status_value, status_id_field )
1 REPLY 1
v-chuncz-msft
Community Support
Community Support

@Anonymous ,

 

DAX Studio can be used to capture queries, you may have a look.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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