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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

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
v-yangliu-msft
Community Support
Community Support

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
v-yangliu-msft
Community Support
Community Support

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors