The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Dear All,
I have the following task that I kindly ask you to help me with :
column YYYYMM , values across months
Column YYYYMM is separated from date.
I want to calculate the value of previous month YYYYMM-1 and show it on the chart
PREVIOUS month doesnt help me as its based on date
Thanks
Solved! Go to Solution.
HI @alextarki,
You can try this measure formula if it meets your requirement:
Measure =
VAR currYM =
MAX ( Table[YearMonth] )
VAR prevDate =
DATE ( LEFT ( currYM, 4 ), RIGHT ( currYM, 2 ) - 1, 1 )
VAR prevYM =
YEAR ( prevDate ) * 100
+ MONTH ( prevDate )
RETURN
CALCULATE (
SUM ( Table[Amount] ),
FILTER ( ALLSELECTED ( Table ), [YearMonth] = prevYM )
)
Regards,
Xiaoxin Sheng
Did this work for anyone ? I have tried the suggested measure definition exactly but still getting BLANKs for all the months. Been searching about this for a couple of days now. I am unabe to use PREVIOUSMONTH() becasue I do not have a proper date column with contiguous dates.
Thanks
How can I build the entire previous month value?
HI @alextarki,
You can try this measure formula if it meets your requirement:
Measure =
VAR currYM =
MAX ( Table[YearMonth] )
VAR prevDate =
DATE ( LEFT ( currYM, 4 ), RIGHT ( currYM, 2 ) - 1, 1 )
VAR prevYM =
YEAR ( prevDate ) * 100
+ MONTH ( prevDate )
RETURN
CALCULATE (
SUM ( Table[Amount] ),
FILTER ( ALLSELECTED ( Table ), [YearMonth] = prevYM )
)
Regards,
Xiaoxin Sheng
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
User | Count |
---|---|
112 | |
80 | |
74 | |
52 | |
50 |
User | Count |
---|---|
132 | |
124 | |
78 | |
64 | |
61 |