Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
9 years ago
Solved

DAX PROMPTS

How do you format a DAX query to run when the its written in sql with a 'prompt parameter" like this example:

 

accept start char Prompt 'Enter Start Date:'

accept end char Prompt 'Enter End Date:'

 

SELECT petf.element_name                          "Element",

       SUM(pdl.distribution_amount)               "Amount",

       ppp.proposed_salary_n                      "Salary",

       to_char(ppl.effective_date, 'YYYY-MM')     "Period",

       paaf.employment_category

FROM (SELECT * FROM "Table_Name" WHERE effective_date BETWEEN '&Start' AND '&End')  tbln

 

 

In this example sql prompts for a Start and End dates but in DAX, you will just get an error. It gets tedious when you have multiple prompts for effective dates.

Please help!

 

 

 

 

  • Hi Anonymous,

     

    I believe you are talking about the query editor correct? Probably you should create a parameter and then add it to your Query so that you can edit the parameters and have the expected result.

     

    Check this link to try and have a first approach to what can be done.

     

    Regards,

    MFelix

2 Replies

  • Hi Anonymous,

     

    I believe you are talking about the query editor correct? Probably you should create a parameter and then add it to your Query so that you can edit the parameters and have the expected result.

     

    Check this link to try and have a first approach to what can be done.

     

    Regards,

    MFelix

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous,

     

    You can try doing this by steps, try firstly run this query:

     

    SELECT petf.element_name,
           SUM(pdl.distribution_amount),
           ppp.proposed_salary_n ,
           to_char(ppl.effective_date, 'YYYY-MM'),
           paaf.employment_category
    FROM (SELECT * FROM "Table_Name")  tbln

     

    If you get results you will get all data without start/end dates.

    Now you can try to insert the start/end columns in your query and filter them.