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

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!

 

 

 

 

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

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


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

2 REPLIES 2
MFelix
Super User
Super User

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


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



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.

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.