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
Keha
Frequent Visitor

Graph the current Month (day-to-day) with previous Month

Hey there,

 

First of thanks to the community for their help already. You guys have been awesome!

 

Now, I am hoping for a solution in a problem that I have just encountered with trying to compare different data over time. I know this has been looked at various times but I was not able to find a fitting solution so far.

 

1) What I am trying to achieve, is to show Data for the current Month, as well as Data for the previous Month up to the specific date (e.g. January 1 - 26; February 1 - 26 (current month) ). I am using the chicletslicer to slice by Month as shown in the Screenshot. Now, it it possible that todays date is automatically drawn even though i have selected the whole month?

 

2) Despite getting this up and running what I am also trying to achieve is to have the two values January/Feburary (current month) put into the graph to show the different values ofer a period of the month in a day-to-day view (screenshot). Also, the Values themselve (e.g. 77 & 51 (sum of values for January), are not changing if I choose a bar on the graph. 

 

I am calculating the previous months values with:

 

Visitors previous month = CALCULATE(SUM('Table'[Visitors]); PREVIOUSMONTH(Datedimension[Date]))

 

However i am not able to show it on a day-to-day graph which does have to do with the PREVIOSMONTH, but I am not sure what to use here. I have tried to create a Table with:

 

same period last month = CALCULATE(SUM('GA_Master 1'[Besucher]);DATEADD('GA_Master 1'[Date];-1;MONTH))

 

But this is not giving me back any values at all. 

 

3) I am trying to show the changes in percentage in color (e.g. Red: Negative, Black: Neutral, Green: Positive). Any suggestions?

 

 

Bildschirmfoto 2017-02-26 um 13.40.19.png 

Thank you guys in advance for any help! 

Kevin

5 REPLIES 5
Phil_Seamark
Employee
Employee

For 1) how does this measure look?

 

I think it should return the value for the same Day of the month for the previous month.

 

Visitors Last Month = 
var Offset = DAY(EOMONTH(LASTDATE('Table'[Date]),-1))
RETURN =CALCULATE(SUM('Table'[Visitors]),DATEADD('Table'[Date],-Offset,DAY)) 

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Hey @Phil_Seamark,

 

 

Thanks a lot. Cut out the '"=" between RETURN and CALCULATE and it is working perfectly! Is there any chance you could give me a quick rundown on the formular and what is actually beeing calculated and how?

 

Cheers! 

 

Hi @Keha

 

Good spotting about the = 

 

I'm sure there are a few approaches but what this does is work out how many days there were in total for the previous month.

 

So if the date of your current row is the 15th of February, it counts the number of days in January (31) and subtracts this number in days from the 15th of Feb.  You can't subtract a hardcoded because you'll end up on a different day.

 

Does that help?


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Hey @Phil_Seamark

 

Splendid! Thanks so much!

 

Any chance you might have an Idea about the colorcoding? 

 

@Keha

 

In a chart, the color of bar is based on the legend and category on X axis. It's not based on the Value. And you have to set it manually. There's no conditional formatting in chart visuals.

 

 

8.PNG

 

Regards,

 

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.