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
DRing
Helper V
Helper V

How can I show % Change of Revenue Data using Year & Month data?

I have very simple data (like below, sample data attached) where I have 3 years of revenue data by state and columns for year and month. My requirements are:


1. User can select a current and comparison period using slicers (either two slicers if mo & year are combined or four slicers if mo and year are seperate).

2. Visual to show Revenue by state for selected and comparison period.

3. Visual to show % change by state for current vs comparison period.

I'm used to working with data where I have a specific date for each data point and I'm struggling with how to modify my approach to work with month/year data.

 

Any thoughts on how I can produce the requried visuals?

Capture.PNG

MonthYearStateRevenue
12022FL915647
22022UT1218951
32022AZ1340223
42022NV2354622
52022CA601569
62022NC854430
72022SC1867108
82022TN1551360
92022AL2305461
102022GA705214
112022WY2102439
122022IA1307902
12023FL504700
22023UT677099
32023AZ1076230
42023NV557247
52023CA1388999
62023NC1689891
72023SC500377
82023TN1173848
92023AL1927590
102023GA1344214
112023WY1456994
122023IA2175240
12024FL2122227
22024UT863611
32024AZ2499410
42024NV1452952
52024CA2204080
62024NC1066495
72024SC1686869
82024TN2056826
92024AL2480275
102024GA2189260
112024WY686364
122024IA1655190
1 ACCEPTED SOLUTION
Daniel29195
Super User
Super User

@DRing 

output 

Daniel29195_0-1709418074741.png

 

 

model : 

Daniel29195_1-1709418128480.png

 

 

steps : 

create the 2 tables  :  currentperiod  and previousperiod as follow : 

currentperiod =
ALLNOBLANKROW(data[Month], data[Year])
 
previousperiod =
ALLNOBLANKROW(data[Month], data[Year])
 
 
step2 
then create a calculated column ,  year-month in the  3 tables : 
 
year-month = 'currentperiod'[Year] & "-" & 'currentperiod'[Month]
 
 
step3 : 
create 2 slicers, reading from currentperiod and previousperiod respectivtly.
 
finally, create the following measures : 
period1 sales =
SUM(data[Revenue])
 
period2 sales =
CALCULATE(
SUM(data[Revenue]),
REMOVEFILTERS(currentperiod),
USERELATIONSHIP(currentperiod[year-month],'previousperiod'[year-month])
)

 

 

diff =
[period1 sales]  - [period2 sales]
 
% variance =
[diff]  /  [period2 sales]
 
 
 
le me know if this helps .
 
 
If my answer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution
It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🤠

 

View solution in original post

6 REPLIES 6
Ashish_Mathur
Super User
Super User

Hi,

I have solved a similar problem in the attached PBI file.  Please review it and apply it to your dataset.

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thanks @Ashish_Mathur Will try this also.

Daniel29195
Super User
Super User

@DRing 

output 

Daniel29195_0-1709418074741.png

 

 

model : 

Daniel29195_1-1709418128480.png

 

 

steps : 

create the 2 tables  :  currentperiod  and previousperiod as follow : 

currentperiod =
ALLNOBLANKROW(data[Month], data[Year])
 
previousperiod =
ALLNOBLANKROW(data[Month], data[Year])
 
 
step2 
then create a calculated column ,  year-month in the  3 tables : 
 
year-month = 'currentperiod'[Year] & "-" & 'currentperiod'[Month]
 
 
step3 : 
create 2 slicers, reading from currentperiod and previousperiod respectivtly.
 
finally, create the following measures : 
period1 sales =
SUM(data[Revenue])
 
period2 sales =
CALCULATE(
SUM(data[Revenue]),
REMOVEFILTERS(currentperiod),
USERELATIONSHIP(currentperiod[year-month],'previousperiod'[year-month])
)

 

 

diff =
[period1 sales]  - [period2 sales]
 
% variance =
[diff]  /  [period2 sales]
 
 
 
le me know if this helps .
 
 
If my answer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution
It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🤠

 

@Daniel29195 Works perfectly! Thank you!

lbendlin
Super User
Super User

No need for slicers, you can do all this directly in the Matrix visual

 

lbendlin_1-1709416897498.png

The new Visual Calculations make this very convenient.  

 

You can show by year or by month,  you can pick any two months etc.  All in the visual.

 

 

Thanks @lbendlin I will try this method as well! I'll follow up after i've tried it.

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.