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
DhirajTuteja
New Member

Issue with DAX Query

Hi,

Using Contoso Sales file in PowerBI desktop.

 

1. How to check the output of New measure created :

PreviousQuarterSales = CALCULATE(SUM(Sales[SalesAmount]), PREVIOUSQUARTER('Calendar'[DateKey]))

 

2. Dragging this measure on Report Canvas is not producing any visual. 

 

 

RegardsDAX Formula.PNG,

Dhiraj Tuteja

 

4 REPLIES 4
v-jiascu-msft
Employee
Employee

Hi @DhirajTuteja,

 

 

Could you please mark the proper answers as solutions?

 

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
OwenAuger
Super User
Super User

Hi @DhirajTuteja

To see a meaningful result, I would suggest including Year & Quarter dimensions on the axis of your visual.

You should also display a normal SUM ( Sales[SalesAmount] ) measure at the same time, so that you can compare adjacent quarters.

 

The reason you are seeing a blank result is that PREVIOUSQUARTER('Calendar'[DateKey]) returns the dates in the calendar quarter immediately preceding the quarter of the first date filtered. If you have not applied any date filters, you effectively have a "filter" including all dates in your Calendar table, so the result of PREVIOUSQUARTER will be an empty set of dates (as there are no dates before the first date in your Calendar table).

 

Regards,

Owen


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn

Hi,

 

I am referring below link :

https://docs.microsoft.com/en-us/power-bi/desktop-quickstart-learn-dax-basics

 

Pl let me know which step I have missed.

 

Regards,

Dhiraj Tuteja

 

Hi Dhiraj,

 

I would suggest you learn something about the Visuals. Please refer to guided-learning/visualizations. Every visual has its own structure and its special meanings. We can judge a DAX formula with Right or Wrong. The result depends on the context which is determined by your purpose. For example, you need to add dates for you measure like it in the snapshot below. 

Issue-with-DAX-Query

 

Best Regards,
Dale

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

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.