How to append current and previous sessions side by side filtered by two independent slicers

How to append current and previous sessions side by side filtered by two independent slicers

<strong>Objective:</strong>&nbsp;I would like obtain the difference between current and previous sessions based on date slicers I want the output to be 4 columns as such:

Objective: I would like obtain the difference between current and previous sessions based on date slicers I want the output to be 4 columns as such:

  • Date
  • Current Sessions (see measure below)
  • Previous Sessions (see measure below)
  • Difference (no measure calculated yet).

Situation: I currently have two measures

  • Current Sessions: SUM(Sales[Sessions])
  • Previous Sessions (thanks to @Alexis Olson):
VAR datediffs = DATEDIFF( CALCULATE (MAX ( 'Date'[Date] ) ), CALCULATE (MAX ('Previous Date'[Date])), DAY ) RETURN CALCULATE(SUM(Sales[Sessions]), USERELATIONSHIP('Previous Date'[Date],'Date'[Date]), DATEADD('Date'[Date],datediffs,DAY) )

I have three tables.

  • Sales
  • Date
  • Previous Date (carbon copy of Date table)

My previous date table is 1:1 inactive relationship with the Date table. Date table is 1 to many active relationship with my Sales Table.

I have two slicers at all time comparing the same amount of days from different time periods (e.g. Jan 1th to Jan 7th 2019 vs Dec 25st to Dec 31th 2019) If i put current sessions, previous sessions and a date column from any of the three tables

+----------+------------------+-------------------+------------+
|   date   | current sessions | previous sessions | difference |
+----------+------------------+-------------------+------------+
| Jan 8th  |            10000 |             70000 |       3000 |
| Jan 9th  |            20000 |             10000 |      10000 |
| Jan 10th |            15000 |             16000 |      -1000 |
| Jan 11th |            14000 |             12000 |       2000 |
| Jan 12th |            12000 |             14000 |      -2000 |
| Jan 13th |            11000 |             16000 |      -5000 |
| Jan 14th |            15000 |             18000 |      -3000 |
+----------+------------------+-------------------+------------+

When I put the Sessions date on the table along with sessions and previous sessions, I get the sessions amounts right for each day but the previous session amounts doesn't calculate correctly I assume because its being filtered by the date rows.

How can I override that table filter and force it to get the exact previous sessions amounts? Basically have both results appended to each other.The following shows my problem. the previous session is the same on each day and is basically the amount of dec 31st jan 2018 because the max date is different for each row but I want it to be based on the slicer. 


power-bi

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Comparing Power BI with other tools

Our Power BI Training will provide you to learn the Power BI tools and making reports easily with realty. Our Power BI Course also includes live sessions, live Pro

Tableau vs Power BI: Comparing the Data Visualization Tools

In analytics, Tableau is the leading visualisation tool. Its rich analytical features and attention to data details are the reason behind its popularity. Power BI, on the other hand, is preferred by professionals who are more comfortable with...

Few Benefits of Power BI

Power BI is a cloud-based tool that does not require capital spending or supporting infrastructure regardless of the size of a company. The tool’s modern iteration is free from outdated technology limitations and in order to generate business...

Which Is Better? Power BI Vs. Tableau

Design Power Apps for you by Power bi training. Know principles of Dynamic 365 and Office 365, By Power BI certification course, unlock Microsoft analytics

Key Benefits of Using Power BI with SQL Server

You may not be aware of the fact that Microsoft was providing BI or Business Intelligence since a long time in its SQL Server but this time in the latest 2016 SQL Server Version, its offering the Power BI that comes packed with features that were...