Forum Discussion

Addams_Katherin's avatar
Addams_Katherin
New Member
3 years ago

Dataset query error in report builder

Hi ,

 

I am using report builder to connect to a power BI dataset. when I use the following DAX query, then it throws an error. does anyone know how to fix it?

 

 

EVALUATE
VAR a = 
        SUMMARIZECOLUMNS (
            'table1'[id],
            'table2'[cid],
            RSCustomDaxFilter(@CDate,EqualToCondition,[CycleDate].[Date],DateTime),
            "MTD Sub ANP", [MTD Sub ANP],
            "Flag", 0,
            "Order",FORMAT(VALUE(MAX('CHANNEL'[Order])) , "#00.0")
        )

VAR b = 
        SUMMARIZECOLUMNS (
            'table1'[type_id],
            'table2'[cid],
            RSCustomDaxFilter(@CDate,EqualToCondition,[CycleDate].[Date],DateTime),
            "MTD Sub ANP", [MTD Sub ANP],
            "Flag", 0,
            "Order",FORMAT(4.5 , "#00.0"),   
            FILTER(CHANNEL , CHANNEL[ID] in {5,6}))
)
return
UNION(a,b)

 

 

thanks.

4 Replies

  • jaweher899's avatar
    jaweher899
    Impactful Individual

     

    Here are some suggestions to help resolve the issue:

    1. Ensure that the columns in the 'table1' and 'table2' referenced in the DAX query exist and are spelled correctly.
    2. Verify that the RSCustomDaxFilter function is defined and its arguments are correct.
    3. Ensure that the cdate variable is defined and its value is valid.
    4. Ensure that the EqualToCondition in the RSCustomDaxFilter function is spelled correctly and used correctly.
    5. Check that the [CycleDate].[Date] and DateTime used in the RSCustomDaxFilter function are defined and match the data type of the referenced data.
    6. Check the syntax of the UNION function, making sure that the number and type of columns in each of the input tables (a and b) match.
    7. Verify that the CHANNEL table used in the FILTER function is defined and its columns (e.g. ID) exist and are spelled correctly.

    Can you please share some examples of data? can you put the error that you get?

  • The error you're encountering might be due to a syntax error in the DAX code. It looks like there's an extra parenthesis at the end of the code.

     

  • Here's the corrected code:

     

    EVALUATE
    VAR a =
    SUMMARIZECOLUMNS (
    'table1'[id],
    'table2'[cid],
    RSCustomDaxFilter(@CDate,EqualToCondition,[CycleDate].[Date],DateTime),
    "MTD Sub ANP", [MTD Sub ANP],
    "Flag", 0,
    "Order",FORMAT(VALUE(MAX('CHANNEL'[Order])), "#00.0")
    )
    
    VAR b =
    SUMMARIZECOLUMNS (
    'table1'[type_id],
    'table2'[cid],
    RSCustomDaxFilter(@CDate,EqualToCondition,[CycleDate].[Date],DateTime),
    "MTD Sub ANP", [MTD Sub ANP],
    "Flag", 0,
    "Order",FORMAT(4.5 , "#00.0"),
    FILTER(CHANNEL , CHANNEL[ID] in {5,6})
    )
    return
    UNION(a,b)

     

     

  • If the error still persists, please provide more details about the error message so I can try to help you better. 

     

    If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂