Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Niels_T
Post Patron
Post Patron

How to display current month in line chart?

Hello,

 

I would like to display the sales of the current month in a line chart and that it automatically updates itself.

 

I've written a DAX measure but it doesn't seem to work: 

Current Month Sales = TOTALMTD(SUM('Magento - Order Line'[Row Total Incl. Tax]),DATESMTD('Calendar'[Date]))

 

Currently I get this:

image.png

 

However I would like to get something like this:

 

image.png

 

 

2 ACCEPTED SOLUTIONS

Hi @Niels_T 

You're using a date hierarchy in your visual

dateh.png

 

Change that to just use Date.  Click the down arrow beside Date (in the axis), then click on Date.

dateh2.png

Regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

Hey Philip,


I tried what you did but this is the result I get:

 

image.png

 

I have set a filter now on date -> relative date -> show items when the value: is in this year and this fixed the issue

 

image.png

 

The measure I used for current month: 

Current Month Sales = TOTALMTD(SUM('Magento - Order Line'[Sales]),'Calendar'[Date], MONTH('Calendar'[Date]) = MONTH(TODAY()))
 
Thanks Philip for the help!

View solution in original post

6 REPLIES 6
PhilipTreacy
Super User
Super User

Hi @Niels_T 

Download sample PBIX file

Try this, note the 3rd parameter which is a filter

 

Current Month Sales = TOTALMTD(SUM('Table'[Value]),'Calendar'[Date], MONTH('Calendar'[Date]) = MONTH(TODAY()))

 

regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


When I use this measure my graph becomes blank:

 

image.png

 

I looked into the power BI file that you provided, and I don't know what you are doing different. 

 

I have a date table and all that so that shouldn't be an issue as well.

Hi @Niels_T 

You're using a date hierarchy in your visual

dateh.png

 

Change that to just use Date.  Click the down arrow beside Date (in the axis), then click on Date.

dateh2.png

Regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Hey Philip,


I tried what you did but this is the result I get:

 

image.png

 

I have set a filter now on date -> relative date -> show items when the value: is in this year and this fixed the issue

 

image.png

 

The measure I used for current month: 

Current Month Sales = TOTALMTD(SUM('Magento - Order Line'[Sales]),'Calendar'[Date], MONTH('Calendar'[Date]) = MONTH(TODAY()))
 
Thanks Philip for the help!
amitchandak
Super User
Super User

@Niels_T , what you have taken on x-axis?

What you are displaying on the x-axis on the visual below?

The two visuals are not related to each other. The visual below also comes from Google Data Studio.

 

The axises contain the following data:

image.png

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.