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
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
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.