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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
PowerBI_AL2022
Regular Visitor

error in calling the defined definition in variable in a measure

Hi All, 

 

i am stuck in recgnizing the error in this measure , kindly anyone please help me out..

 

MAX_QTY_SKU3 Test 1 =
VAR _VW_DESIGNITEM_DS6_IS6_SUMMARIZED =
    SUMMARIZECOLUMNS (
        VW_DESIGNITEM_DS6_IS6[NAME],
        "CATALOG", DISTINCTCOUNT(VW_DESIGNITEM_DS6_IS6[PARTITIONKEY]),
        "ADDS", SUM(VW_DESIGNITEM_DS6_IS6[QUANTITY])
    )
VAR _AddRank =
    ADDCOLUMNS (
        _VW_DESIGNITEM_DS6_IS6_SUMMARIZED,
        "Rank", RANKX (_VW_DESIGNITEM_DS6_IS6_SUMMARIZED, [ADDS],, DESC, DENSE)
    )
VAR _qty = TOPN(1,_AddRank,[Rank],ASC)
RETURN SELECTCOLUMNS(_qty,[CATALOG])
 
CATALOG in this measure is showing error mark nd even the results are not summing up well..
 
thanks in advance 🙂
2 REPLIES 2
v-zhangti
Community Support
Community Support

Hi, @PowerBI_AL2022 

 

The SELECTCOLUMNS function returns a calculated table, not a measure. 

SELECTCOLUMNS function (DAX) - DAX | Microsoft Learn
You can try :

RETURN SUMX(_qty,[CATALOG])

 

Can you provide sample data for testing? Sensitive information can be removed in advance. What kind of expected results do you expect? You can also show it with pictures or Excel. I look forward to your response.

 

Best Regards,

Community Support Team _Charlotte

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

Thank you so much for your response.

I tried your suggestion i.e. using SUMX instead of SELECTCOLUMNS but it still seem not to be working.

 

Attaching the image for reference :

PowerBI_AL2022_0-1701778146234.png

 

here the highlighted 2 KPIs in yellow are the ones which have issues , 

KPI result 37.06% uses the formula "DIVIDE([MAX_QTY_SKU3],[Projects])+0"

 

and MAX_QTY_SKU3 uses the calculation as show below:

MAX_QTY_SKU3  =
VAR _VW_DESIGNITEM_DS6_IS6_SUMMARIZED =
    SUMMARIZECOLUMNS (

        VW_DESIGNITEM_DS6_IS6[NAME],

        "CATALOG", DISTINCTCOUNT(VW_DESIGNITEM_DS6_IS6[PARTITIONKEY]),

        "ADDS", SUM(VW_DESIGNITEM_DS6_IS6[QUANTITY])

    )
VAR _AddRank =

    ADDCOLUMNS (

        _VW_DESIGNITEM_DS6_IS6_SUMMARIZED,

        "Rank", RANKX (_VW_DESIGNITEM_DS6_IS6_SUMMARIZED, [ADDS],, DESC, DENSE)

    )

VAR _qty = TOPN(1,_AddRank,[Rank],ASC)

RETURN SELECTCOLUMNS(_qty,[CATALOG]) 
 
the problem here is when any bar in the chart is selected , the KPI s donot show any result and displays an error message like this ..
 
PowerBI_AL2022_1-1701778467818.png

 

so i am unable to find out whats the issue here , 

 

the connection between the tables used in the bar chart and KPI s are well defined in the data model so there is no issue there.

 

i also tried to change the function used in the measure as you suggested but it didnt work .

 

please guide me in anyway possible , it would be really helpfull .

Thanks for your time and knowledge.

Regards.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.