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

X- axis based on the selected date

Hi experts,

Need your help here.

We have two dates in our dataset, say Order Date and Sales date. Based on the User, we want to change the X-axis of a bar graph. If user wants to see data based on the Sales Date, then X- axis should show sales date and if selected value id Order date, then X- axis should show Order date 

ShanayaK_0-1598491399496.png

Thanks

 

6 REPLIES 6
Anonymous
Not applicable

Hi @amitchandak . Thanks for your response.

This is the data model we have 

ShanayaK_0-1598498384680.png

and the expected output is 

ShanayaK_1-1598498463103.png

Please advise. Thanks

Greg_Deckler
Super User
Super User

@Anonymous - See if this helps: https://community.powerbi.com/t5/Quick-Measures-Gallery/Dynamic-EVERYTHING-measures-axis-legend-titles-chart-types/m-p/1027881#M444


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Thanks @Greg_Deckler  for your reply.

In our case we have two date dimensions. one is for Sales date and other if Order date.

What i am trying ...

I have created a table like 

ShanayaK_0-1598493641216.png

Then used the 'Select date' column in the slicer and trying to write a DAX logic like- 

SelectedDate = IF(SELECTEDVALUE('Date Selection'[Select date]) = 1, Sales Date[Date], Order Date[Date])

But it is not allowing me to use Sale Date[Date] and Order Date[Date] in the DAX.

 

Any idea??

 

@Anonymous - Well if that is a measure and you are referring to a column, you need to use an aggregation like MAX, MIN, etc. But, to use a measure in that way you generally need to use a disconnected table. In general, to use a measure in that way, you need to use the Disconnected Table Trick as this article demonstrates: https://community.powerbi.com/t5/Community-Blog/Solving-Attendance-with-the-Disconnected-Table-Trick/ba-p/279563


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Thanks @Greg_Deckler  for a quick reply.

In my case, Sale Date[Date] and Order Date[Date] are two date type columns. 

So can not apply any aggregate function.

 

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.

Top Solution Authors