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.
Hello,
I am working on a dashboard for our Paid Search Campaign. Different campaigns are having different ID and the datasource containing data for each and every campaign ID.
I am trying to set up an graph to show WoW changes in conversion (Order and Revenue).
Created Mesure for that and that is working perfectly for over all data. But when I am trying to filter it with the campaign ID - it returns wrong value.
The Mesures I have created are:
1. Total Order = SUM('Sheet1 (2)'[Orders])
2. Previous Week Oder =
CALCULATE('Sheet1 (2)'[Total Order],
FILTER(ALL('Sheet1 (2)' ),
'Sheet1 (2)'[Week] = SELECTEDVALUE('Sheet1 (2)'[Week]) - 1 &&
'Sheet1 (2)'[Year] = SELECTEDVALUE('Sheet1 (2)'[Year])))
3. WoW % Change in Order = DIVIDE('Sheet1 (2)'[Total Order],'Sheet1 (2)'[Previous Week Oder],0)-1
These 3 mesures are working perfectly in general condition, but when I am filtering with Campaign IDs
Mesure 1(Total Order) is working but Mesure 2(Previous Week Oder) is not - as a result Mesure 3 (WoW % Change in Order) is showing wrong data.
Any help?
Regards
Utsav
Solved! Go to Solution.
Hey,
from looking at your DAX Statement for your measure "Previous Week Order" you use
ALL('Sheet1 (2)')
This ALL statement also "resets" the filtering of the underlying data to ALL campaigns, use this instead
ALL(
'Sheet1 (2)'[Week]
,'Sheet1 (2)'[Year]
)
Hopefully this is what you are looking for
Regards,
Tom
Hey,
from looking at your DAX Statement for your measure "Previous Week Order" you use
ALL('Sheet1 (2)')
This ALL statement also "resets" the filtering of the underlying data to ALL campaigns, use this instead
ALL(
'Sheet1 (2)'[Week]
,'Sheet1 (2)'[Year]
)
Hopefully this is what you are looking for
Regards,
Tom
Hey Tom,
I would like to ask you a question that is relavant with this issue. Currently I am working with 2018 data only - but in next year the Week Numbers will be repeted and I guess that time I need to modify the DAX Statement to avoid the duplication issue.
Can u suggest something on this?
Regards
Utsav
Hey,
here you will find a PBIX file.
This file contains two tables "Fact" and "Calendar M". The table Fact represents your table and the table Calendar M is a separate Calendar table.
There are 2 different approaches how/where to create the Calendar table, namely PowerQuery/M and DAX. Personally I'm using Power Query and M to create my Calendar table, this allows to reference the Calendar table from other Power Query queries during the data preparation phase. In this example I'm using a Merge Join to create the Date colum in the Fact table.
Basically the pbix works like this:
Basically the creation of the Calendar table using Power Query / M is straightforward. The column "YearWeekNumber Index" is created using multiple steps (for simplicity I omitted the custom function that I'm using):
This creates a column that contains the value 1 for each day in the first week in the first year of the calendar table, and the value 2 for the 2nd week in ...
This column can be used for all calendar based caluculations that need some kind of index, e.g. "last three weeks" or "WoW -Growth".
An example is the calculation of the measure "WoW Growth".
Due to the fact, that the fact table "Fact" reflects measurements that have a granularity of weeks, but the Calendar table features a daily granularity (this is common and best practice for calendar tables), it's necessary to create a date column in the fact table.
This is done by using a merge join from the fact table to the calendar table based on the column "YearWeekNumber". Due to the fact that this would return many days I decided to return the latest day of the joined week, this is done by the query step ""
= Table.AggregateTableColumn(#"Merged Queries", "Calendar M", {{"Date", List.Max, "Date"}})
After the data preparation is done, both tables can be related using the column Date.
Hopefully this gets you started.
Regards,
Tom
Hello Tom,
Sorry to say that this solution is too much tough for me to handle.
The logics used are difficult for me to understand.
Can you refer any other simplyfied process?
Regards
Utsav
Hello Tom,
I am working on your suggestion and will let you know about the result. As it is very complicated for me (as a newbie) - you can understand it will take sometime for me to understand and implement the logics.
But I have no words to Tanking You for this. I am glad that you took so much of your time and energy to help me.
Regards
Utsav
Thanks Tom,
It is working perfectly now. Within the filter function I have mentioned (as suggested by you) that Week and Year needs to be filter only.
Thanks again.
Regards
Utsav
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
106 | |
94 | |
76 | |
62 | |
50 |
User | Count |
---|---|
147 | |
106 | |
104 | |
87 | |
61 |