Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Dear Guru:
I want to write measure to rank material with the inventory value of previous month. I've created a measure to rank the material with current inventory value(selected period). I want to show the rank change between selected period and (selected period -1). below is the measure I create:
thanks for the help.
--Tonny
Hi @tonny_bwg ,
You can try using the following dax:
Measure =
var _selectYearMonth=SELECTEDVALUE('Table'[YearMonth])
var _date=
MINX(
FILTER(ALL('Table'),
'Table'[YearMonth]=_selectYearMonth),[Date])
var _maxdate=
EOMONTH(_date,-1)
var _mindate=
EOMONTH(_date,-2)
return
RANKX(
FILTER(ALLSELECTED('Table'),
'Table'[Date]>_mindate&&'Table'[Date]<=_maxdate),CALCULATE(SUM([Value])),,ASC)
Can you share sample output in table format? Or a sample pbix after removing sensitive data. We can better understand the problem and help you
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
could you please help to solve this issue?
Hi,Mr. LiuYang
appreciated your help. please use this sample file to create previous month's rank. thanks
the fact table is as below, and a Dim_date table, a dim_Area tbl, Dim_material table link to fact table.
my question is how to calcualte previous month rank based on current filter context.
thanks for your help.
--Tonny