The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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 of the Previous category
Result would in the above be
Category Value Comparator
1 3 Blank()
2 6 2 (6/3)
3 7 2.16667
Solved! Go to Solution.
@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)
)
Proud to be a Super User! |
|
you can try this to create a column
Proud to be a Super User!
I advise you to try Visual calculation
watch the video
https://1drv.ms/v/c/916e1b3b6bd11925/ETgKUwdi8jBHgm614cvePPABaF_QRQg6jXqHfEEKuaQ22A?e=3dYdSy
Hi @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!
Hi none of the answers addressed my problem.
you can try this to create a column
Proud to be a Super User!
You could create a measure like
Comparator =
VAR CurrentValue = SUM( 'Table'[Value] )
VAR PrevValue = CALCULATE(
SUM( 'Table'[Value] ),
OFFSET(
-1,
ALLSELECTED( 'Table'[Category] ),
ORDERBY( 'Table'[Category], ASC )
),
ALLEXCEPT( 'Table', 'Table'[Category] )
)
VAR Result = DIVIDE( CurrentValue, PrevValue )
RETURN Result
@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)
)
Proud to be a Super User! |
|
User | Count |
---|---|
78 | |
74 | |
43 | |
32 | |
28 |
User | Count |
---|---|
104 | |
95 | |
51 | |
50 | |
46 |