Home > Enterprise >  Power BI - Timeseries compare two different start dates
Power BI - Timeseries compare two different start dates

Time:12-28

I want to compare how different campaigns are progressing based on number of days into the campaign rather than by date (see day1, day2, etc... on the x-axis below).

Here is my DAX code, but I can't get it to work. Any help would be much appreciated...

**Normalised Campaign Metrics =
VAR DateReached = CALCULATE(MIN(Days[Day]),db[PAYMENT_DATE]<> BLANK(), KEEPFILTERS(db[PRODUCT_CODE SWITCH]))
VAR MaxDate = CALCULATE(MAX(db[PAYMENT_DATE]),KEEPFILTERS(db[PRODUCT_CODE SWITCH]))
VAR DayNo = SELECTEDVALUE(Days[Day])
RETURN CALCULATE(count(db[PAYMENT_DATE]),
FILTER(ALL(db[PAYMENT_DATE]),
DateReached DayNo && DateReached DayNo<=MaxDate))**

Many thanks! enter image description here

CodePudding user response:

I would recommend solving this through manipulating your actual data rather than a complex DAX measure. If you are familiar with star schema modelling, I would solve this problem by adding a new column to your fact table that calculates how many days from the start date the payment occurred and then connect this column to a new "Days Passed" dimension that is simply a list of numbers from 1 to however many days you need. Then, you can use this new dimension as the source data for your x axis and use a standard payment amount measure for your y axis.

CodePudding user response:

I recommend to create a dimension table as the relative basis to comparison with inactive relationship. Here is a video about it:

https://youtu.be/knXFVf2ipro

  • Related