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 a set of data that has to be evaluated taking in account the previous month.
I am presenting a mock dataset (normal month/value columns) and the desired output.
I need a measure that for each month it evaluates itself PLUS a function of the previous month.
I can't manage this situation as the filters block me to evaluate the previous months.
I appreciate your help,
V
Solved! Go to Solution.
Hi @Anonymous ,
As the screenshot you shared, we should convert the month column from text to number by creating a calculated column.
MonthNumber = SWITCH ( 'Dataset'[Month], "January", 1, "February", 2, "March", 3, "April", 4, "May", 5, "June", 6, "July", 7, "August", 8, "September", 9, "October", 10, "November", 11, "December", 12 )
Then we can create the following measure to meet what you need.
CurrentMonth = SUM ( 'Dataset'[Value] )
NextMonth/2 = FORMAT ( CALCULATE ( SUM ( 'Dataset'[Value] ), FILTER ( ALL ( 'Dataset' ), 'Dataset'[MonthNumber] = SELECTEDVALUE ( 'Dataset'[MonthNumber] ) + 1 ) ) / 2, "General Number" )
Total = IFERROR ( [CurrentMonth] - [NextMonth/2], BLANK () )
BTW, pbix as attached.
Hi @Anonymous ,
As the screenshot you shared, we should convert the month column from text to number by creating a calculated column.
MonthNumber = SWITCH ( 'Dataset'[Month], "January", 1, "February", 2, "March", 3, "April", 4, "May", 5, "June", 6, "July", 7, "August", 8, "September", 9, "October", 10, "November", 11, "December", 12 )
Then we can create the following measure to meet what you need.
CurrentMonth = SUM ( 'Dataset'[Value] )
NextMonth/2 = FORMAT ( CALCULATE ( SUM ( 'Dataset'[Value] ), FILTER ( ALL ( 'Dataset' ), 'Dataset'[MonthNumber] = SELECTEDVALUE ( 'Dataset'[MonthNumber] ) + 1 ) ) / 2, "General Number" )
Total = IFERROR ( [CurrentMonth] - [NextMonth/2], BLANK () )
BTW, pbix as attached.
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.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
108 | |
78 | |
77 | |
46 | |
39 |
User | Count |
---|---|
137 | |
108 | |
64 | |
64 | |
53 |