Forum Discussion
GouldM
1 year agoRegular Visitor
Comparing to a 'Previous Category'
Supposing I have data in this table Category Value 1 3 2 6 3 7 How could I create a measure that DIVIDEs the value of a category but the value o...
- 1 year ago
GouldM , Create a measure using
DAX
Comparator =
VAR CurrentCategory = 'Table'[Category]
VAR PreviousCategoryValue =
CALCULATE(
MAX('Table'[Value]),
FILTER(
'Table',
'Table'[Category] = CurrentCategory - 1
)
)
RETURN
IF(
ISBLANK(PreviousCategoryValue),
BLANK(),
DIVIDE('Table'[Value], PreviousCategoryValue)
) - 1 year ago
you can try this to create a column
Column =var _last=maxx(FILTER('Table','Table'[category]=EARLIER('Table'[category])-1),'Table'[value])return if(ISBLANK(_last),blank(),DIVIDE('Table'[value],_last))or try this to create a measureMeasure =var _last=maxx(FILTER(all('Table'),'Table'[category]=max('Table'[category])-1),'Table'[value])return if(ISBLANK(_last),blank(),DIVIDE(max('Table'[value]),_last))pls see the attachment below
v-aatheeque
Community Support
1 year agoHi GouldM
If a community member's response addressed your query, please consider marking it as Accepted Answer and click Yes if you found it helpful.
If you have any further questions, feel free to reach out.
Thank you for being a valued member of the Microsoft Fabric Community Forum!
GouldM
1 year agoRegular Visitor
Hi none of the answers addressed my problem.
- ryan_mayu1 year ago
Super User
you can try this to create a column
Column =var _last=maxx(FILTER('Table','Table'[category]=EARLIER('Table'[category])-1),'Table'[value])return if(ISBLANK(_last),blank(),DIVIDE('Table'[value],_last))or try this to create a measureMeasure =var _last=maxx(FILTER(all('Table'),'Table'[category]=max('Table'[category])-1),'Table'[value])return if(ISBLANK(_last),blank(),DIVIDE(max('Table'[value]),_last))pls see the attachment below