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.
Hi All
I have a rolling 12 month expression working fine :-
My PBI file
Paul
Solved! Go to Solution.
Hi @Paulyeo11 ,
Please let us know if the replies above are helpful.
If they are, please always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.
If not, please give us more details.
Best Regards,
Icey
Hi @Paulyeo11 ,
Please let us know if the replies above are helpful.
If they are, please always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.
If not, please give us more details.
Best Regards,
Icey
@Paulyeo11 , it seem like you are restricting the measure to current month and tryoing to get last 12 month rolling data for that month
Yes, becasue the value for _LAST12 in Dec 2019 is a blank. Like I said, I'd need answers to these questions to be able to help:
1. What would the visual have to show exactly?
2. One value for Dec 2020 and one value for Dec 2019?
3. What values exactly in each of those two cases?
Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
Hi AIB
Now i understand after test your script at my actual doc.
1. What would the visual have to show exactly? Answer :- i like to use the stright table to show the rolling sales amount for 12 mth and also the next year rolling 12 month. So meaning the 2 field must be seperated. ( The reasons i use stright table , so that user can export to excel and get the data with need to create pivot table again )
2. One value for Dec 2020 and one value for Dec 2019? Answer :- Yes correct 2 seperate value. and 2 seperate label.
3. What values exactly in each of those two cases? Answer :- One value is for Jan till Dec 2000 another one is Jan till Dec 2019.
Remark :- You have created the 20 Dec , and now i need to focus on create stand alone 19 Dec.
Thak you for your help.
Paul
I'm not sure I understand correctly. What would the visual have to show exactly? One value for Dec 2020 and one value fro Dec 2019? What values exactly in each of those two cases?
Try this, a measure that should shows the previous 12 months in Dec 2020 and the previous 12 months in Dec 2019
_LAST12_extended V2 =
VAR currentYM_ =
FORMAT ( TODAY (), "yy mmm" )
VAR currentYM12_ =
FORMAT ( EDATE ( TODAY (), -12 ), "yy mmm" )
VAR selectedYM_ =
SELECTEDVALUE ( 'Date'[YrMth] )
RETURN
IF (
selectedYM_ IN { currentYM_, currentYM12_ },
CALCULATE (
SUM ( SALES[sales] ),
DATESINPERIOD ( 'Date'[Date], MAX ( SALES[date] ), -12, MONTH )
)
)
Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
Hi AIB
thank you for sharing , i still get 20 Dec :-
Above is my PBI file
Paul
See it all at work in the attached file (Page 2)
Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
Hi @Paulyeo11
1. Place Date[YrMth] in the columns of the visual
2. Modify the measure bit so that it only shows the current (today's) month
_LAST12 V2 =
VAR currentYM_ =
FORMAT ( TODAY (), "yy mmm" )
VAR selectedYM_ =
SELECTEDVALUE ( 'Date'[YrMth] )
RETURN
IF (
currentYM_ = selectedYM_
|| NOT ISFILTERED ( 'Date'[YrMth] ),
CALCULATE (
SUM ( SALES[sales] ),
DATESINPERIOD ( 'Date'[Date], MAX ( SALES[date] ), -12, MONTH )
)
)
Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
Hi AIB
wow , you are good , this is what i am looking for.
I try to modify your script for one more field , that is rolling month for next 12 month :-
My PBI file
Can you pls share with me how to make it display 19 DEc ?
Paul
@Paulyeo11 , You use month name on the column of matrix
or see if dynamic titles can help : https://www.youtube.com/watch?v=XXv13mkjV2Y&feature=youtu.be
Hi Amit
Thank you for sharing the video , it is not suitable for rolling month expression , as user is not going to selectedvalue.
How ever it can use it for my another application. I can add this feature.
Paul
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
110 | |
109 | |
89 | |
76 | |
66 |
User | Count |
---|---|
126 | |
112 | |
99 | |
82 | |
73 |