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.
I'm using a simple data source with with Cost and YearMonth in number format "20191, 20192, 20193". I want a dynamic "Cost This Month" and "Cost Last Month" measure that updates every month.
I have created two measures "This Month" and "Previous Month":
This Month = MAX(Sheet1[YearMonth])
Solved! Go to Solution.
Thanks guys, it was as easy as this:
and
Thanks guys, it was as easy as this:
Hi,
We will have to create a Date column from the Year Month column. We will then create a Calendar Table and build a relationship from the Date column of your base data sheet to the Date column of your Calendar Table. In the Calendar Table, we will then write calculated column formulas to extract the Year and Month. Once this is done, we can write simple measures to get your desired result.
Hi @Anonymous ,
Assuming that you have the data sample like below.
Then you could create the measure below. You could modify the measure based on your actual requirement.
Measure = CALCULATE ( SUM ( 'Table1'[Cost] ), FILTER ( 'Table1', 'Table1'[YearMonth] = MAX ( 'Table1'[YearMonth] ) ) ) Measure 2 = CALCULATE ( SUM ( Table1[Cost] ), FILTER ( ALLSELECTED ( 'Table1' ), 'Table1'[YearMonth] = IF ( RIGHT ( FORMAT ( MAX ( 'Table1'[YearMonth] ), "" ), 1 ) = "1", BLANK (), MAX ( 'Table1'[YearMonth] ) - 1 ) ) )
Here is the output.
Best Regards,
Cherry
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 |
---|---|
109 | |
98 | |
80 | |
64 | |
57 |
User | Count |
---|---|
145 | |
111 | |
92 | |
84 | |
66 |