Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

How to create measure to display value from previous label without calculated column

Hi,

 

How can I create a measure which can be populated for each row in [# Issues in Prev Month] based on [# Issues] of the previous label without using a calculated column? The label is actually a month, but is not in the default month format.

 

 # Issues# Issues in Prev Month
2018M1250
2019M0135
2019M0243
2019M0354
1 ACCEPTED SOLUTION
Mariusz
Community Champion
Community Champion

Hi @Anonymous 

Please see the example below

LM Sales =
CALCULATE(
[Sales Amount], -- Mesure 
PREVIOUSMONTH('Date'[Date]) --PREVIOUSMONTH function with Date field from Calendar table
)

Hope this helps
Mariusz

View solution in original post

5 REPLIES 5
Mariusz
Community Champion
Community Champion

Hi @Anonymous 

Please see the example below

LM Sales =
CALCULATE(
[Sales Amount], -- Mesure 
PREVIOUSMONTH('Date'[Date]) --PREVIOUSMONTH function with Date field from Calendar table
)

Hope this helps
Mariusz
Anonymous
Not applicable

Hi @Mariusz ,

 

I have tried the PREVIOUSMONTH function but to not much success... The label does not seem to be recognised as a month.

 

The error says "A column specified in the call to function 'PREVIOUSMONTH' is not of type 'DATE'. This is not supported."

 

 

Hi @Anonymous 

You can use the below patern 

Add Column // 

Rank =
RANKX(
ALL(Table1),
INT(SUBSTITUTE(Table1[Month], "M", "")),,
ASC
)

Add Measure:~
PM Value =
VAR PM = MIN(Table1[Rank]) -1
RETURN
CALCULATE(
SUM(Table1[Value]),
ALL(Table1),
Table1[Rank] = PM
)

 

Anonymous
Not applicable

Hi @Mariusz, Unfortunately this also does not work as my column of values are actually calculated values and not really a column in the data model, so it seems like the sum() function will not accept my "column" of measures. Thanks for your help. I will try to obtain the column of dates to make the PREVIOUSMONTH work instead.

Hi @Anonymous 

 

You can use MAX instead 

Mariusz

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.