Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.
Check it out now!Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more
In power bi, i would like to figure out a way to compare Position ID's on a week to week basis. The results will be the exact position id's that are new(added) positions and removed positions from the data. the visuals will show the counts of new and removed positions, along with a second visual which can display the new and removed positions. The data table with position id's is uploaded into powerbi every wednesday and a source date column is added to identify when the data was uploaded, so every week there is a new source date added. The data table is not overwritten, it is added to the existing data table.. currently the data table has 6 weeks of data. Position Id's are a sequence of 8 numbers, all ids are unique.
Thanks in advance for your help!
Solved! Go to Solution.
Hi @rasputin ,
I created some data:
Here are the steps you can follow:
1. Create measure.
Max_ID =
var _maxdate=
MAXX(ALL('Table'),'Table'[Date])
var _week=
WEEKNUM(_maxdate,2)
return
MAXX(
FILTER(ALL('Table'),
WEEKNUM('Table'[Date],2) = _week-1&&'Table'[Group]=MAX('Table'[Group])),[Location ID])
comparisons =
IF(
MAX('Table'[Location ID])<> [Max_ID],1,0)
new_count =
SUMX(
FILTER(ALLSELECTED('Table'),WEEKNUM('Table'[Date],2)=WEEKNUM(MAX('Table'[Date]),2)),[comparisons])
remove_count =
SUMX(
FILTER(ALLSELECTED('Table'),WEEKNUM('Table'[Date],2)=WEEKNUM(MAX('Table'[Date]),2)&&'Table'[comparisons]=1),[comparisons])
new positions =
IF(
MAX('Table'[Location ID]) = [Max_ID],MAX('Table'[Location ID]),BLANK())
removed positions =
IF(
MAX('Table'[Location ID]) <>[Max_ID],[Max_ID],BLANK())
2. Result:
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
Hi @rasputin ,
I created some data:
Here are the steps you can follow:
1. Create measure.
Max_ID =
var _maxdate=
MAXX(ALL('Table'),'Table'[Date])
var _week=
WEEKNUM(_maxdate,2)
return
MAXX(
FILTER(ALL('Table'),
WEEKNUM('Table'[Date],2) = _week-1&&'Table'[Group]=MAX('Table'[Group])),[Location ID])
comparisons =
IF(
MAX('Table'[Location ID])<> [Max_ID],1,0)
new_count =
SUMX(
FILTER(ALLSELECTED('Table'),WEEKNUM('Table'[Date],2)=WEEKNUM(MAX('Table'[Date]),2)),[comparisons])
remove_count =
SUMX(
FILTER(ALLSELECTED('Table'),WEEKNUM('Table'[Date],2)=WEEKNUM(MAX('Table'[Date]),2)&&'Table'[comparisons]=1),[comparisons])
new positions =
IF(
MAX('Table'[Location ID]) = [Max_ID],MAX('Table'[Location ID]),BLANK())
removed positions =
IF(
MAX('Table'[Location ID]) <>[Max_ID],[Max_ID],BLANK())
2. Result:
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