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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
dpwhitey
Regular Visitor

Week on Week Variance, with a 2 week dataset

dpwhitey_0-1647577126116.png

 

Hello all,

 

New Power BI use., Thanks in advance for any help.

 

I have a report that runs a past 14 day dataset that is refreshed each week. I need to be able to display in Power BI in the above format.

 

My questions are - regarding bins -

1. When I set the number of bins as 2, the bin size is automatically 6.5 days? Why is this not 7 days? When I manually set the bin size at 7 days, it creates 3 bins. Why?

 

dpwhitey_1-1647577409312.png

 

2. Can I use bins to calculate a variance of bin1 vs bin2? If so how can I do this? I can't seem to find the correct syntax when I search.

 

3. Can I edit the bin name? The bin name defaults to the earliest date, which isn't helpful in the visualisation

 

dpwhitey_2-1647577969992.png

 

 

I have also tried to create a calculated colum with this formula, to display the week end date.  Is it better to use a column and calculate a variance measure on Week1 vs Week2?  What is the easiest way to add a "Week 1" and "Week 2" label to the first and last 7 days in a dataset? 

 

WeekEndDate =
VAR d =
MAX ( 'Mental Health Caseload'[Case Date] )
RETURN
d
- QUOTIENT ( DATEDIFF ( 'Mental Health Caseload'[Case Date], d, DAY ), 7 ) * 7

 

Thanks

 

Daniel

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

HI @dpwhitey,

How did you table store the date fields? stored in multiple fields or one field? If you mean multiple date fields, I'd like to suggest you do unpivot columns on them.

Unpivot columns - Power Query | Microsoft Docs

Then you can add a calculated field to check unpivoted date values to return the custom tag of these fields (remark them to week 1, week 2) for matrix column filed usages.

If you are confused about these operations, can you please share a pbix or some dummy data that keep raw data structure with expected results? It should help us clarify your scenario and test to coding formula.

How to Get Your Question Answered Quickly  

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

2 REPLIES 2
v-shex-msft
Community Support
Community Support

HI @dpwhitey,

How did you table store the date fields? stored in multiple fields or one field? If you mean multiple date fields, I'd like to suggest you do unpivot columns on them.

Unpivot columns - Power Query | Microsoft Docs

Then you can add a calculated field to check unpivoted date values to return the custom tag of these fields (remark them to week 1, week 2) for matrix column filed usages.

If you are confused about these operations, can you please share a pbix or some dummy data that keep raw data structure with expected results? It should help us clarify your scenario and test to coding formula.

How to Get Your Question Answered Quickly  

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
lbendlin
Super User
Super User

Please provide sanitized sample data that fully covers your issue. If you paste the data into a table in your post or use one of the file services it will be easier to work with. Avoid posting screenshots of your source data if possible.

Please show the expected outcome based on the sample data you provided. Screenshots of the expected outcome are ok.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.