cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
donaldo
Helper III
Helper III

Compare Weekly History by user selected weeks

Hi PBI Community,

 

I have a SQL table that is archived weekly and dumped into a table. The setup is roughly like this:

 

ID (with duplicates)StageValueAssociated DateTimestamp of backup
123110001-01-202012-01-2020
123215001-02-202019-01-2020
NNNNN

 

It goes weekly, so by the end of the year I'll have 52 rows of the same ID with varying stages, values and dates plus a weekly timestamp. 

 

I have a request for users to be able to select two seperate weeks and compare them in a Power BI report. 

IDStageValue 1. selectionValue 2. selectionValue differenceAssociated Date 1Associated Date 2Date difference
12321001505001-01-202001-02-202031 days

 

In this scenario the user would need the option to select both Value 1 and 2 by week and across years maybe.

 

I've been thinking along the lines of slicer - but that will impact both, whats going to be measures, I guess.

  • Can I do a measure and insert a slicer as a filter in a CALCULATE? But not have the slicer affect the table?
  • Or create a seperate table with all the week numbers and use a slicer or some sort of user interaction as input to a measure?

 

Hope anyone has an idea.

Screenshot of the table

pbi.png

 

 
1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi ,

You can make a slicer based on a table of weeks and the selection on one slicer with two selection and then make the measure something similar to this:

VALUE1 =
CALCULATE (
SUM ( Table[Column] );
FILTER ( ALL ( Table[week] ); Table[week] = MIN ( weekstable[week] ) )
)


VALUE2 =
CALCULATE (
SUM ( Table[Column] );
FILTER ( ALL ( Table[week] ); Table[week] = MAX ( weekstable[week] ) )
)

Be aware that if people select more than 1 week it will return the difference between the max and min week so you can add a meaure to say that people should only choose two weeks.

Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

2 REPLIES 2
MFelix
Super User
Super User

Hi ,

You can make a slicer based on a table of weeks and the selection on one slicer with two selection and then make the measure something similar to this:

VALUE1 =
CALCULATE (
SUM ( Table[Column] );
FILTER ( ALL ( Table[week] ); Table[week] = MIN ( weekstable[week] ) )
)


VALUE2 =
CALCULATE (
SUM ( Table[Column] );
FILTER ( ALL ( Table[week] ); Table[week] = MAX ( weekstable[week] ) )
)

Be aware that if people select more than 1 week it will return the difference between the max and min week so you can add a meaure to say that people should only choose two weeks.

Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Brilliant and simple. Thanks.

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors