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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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