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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
rasputin
New Member

week to week comparison of position id's results showing new and removed position id's

 

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!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @rasputin ,

I created some data:

vyangliumsft_0-1699874300441.png

 

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:

 

vyangliumsft_1-1699874300442.png

 

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

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi  @rasputin ,

I created some data:

vyangliumsft_0-1699874300441.png

 

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:

 

vyangliumsft_1-1699874300442.png

 

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

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Users online (1,277)