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.
Dear Community,
Firstly, I would like to show some sample data table and it's format. These are testing data on which I would like to explain my problem:
Task description: One slicer has to be used, field: 'Table[Date(YYYY-WW)]), comparing two weeks: current week - it's a week selected by an user on the slicer versus previous week - (current week -1). I have to use pie chart to show amount of IDs by two conditions:
According to upper table, there would be 1 ID in "Increase" group: C - because it appeared in two analyzed weeks + value in selected week is greater than previously and 1 ID in "Decrease" group: A -because it appeared in two analyzed weeks + value in selected week is lower than previously.
Problem with max week from previous year:
I wrote couple of measures which are used to filter the table:
Unfortunately, previous_week measure doesn't work correctly, MAX week value in whole table is 53, if previous year has lower max week value than 53, measure returns blank value (if previous year has a max value equal to the max value from whole table, it works perfectly).
This is the first problem with which I am counting on your help.
Problem with comparing two CALCULATEDTABLES:
I wrote two measures, which create two "virtual" tables in filtered weeks, but unfortunately I have no idea how to compare them, so I can obtain desired results:
I will be really grateful for any form of help provided!
@serax , for this, it is best to create a separate year week table with year week (YYYY-WW), year and week. Say date
have rank column in date table
Week Rank RANKX(all('Date'),'Date'[Year Week],,ASC,Dense) //YYYYWW format
measures
This Week = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])))
Last Week = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])-1))
Time Intelligence, DATESMTD, DATESQTD, DATESYTD, Week On Week, Week Till Date, Custom Period on Period,
Custom Period till date: https://youtu.be/aU2aKbnHuWs&t=145s
Power BI — Week on Week and WTD
https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3
https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-La...
https://www.youtube.com/watch?v=pnAesWxYgJ8
Hello @amitchandak
Your proposed solution by using RANK solved my MAX_WEEK issue - thanks! But still I have no clue how to compare two calculated tables.
Best regards!
HI @serax,
Perhaps you can try to use ADDCOLUMNS and LOOKUPVALUE functions to add new table columns to the current table based on id.
ADDCOLUMNS function (DAX) - DAX | Microsoft Learn
LOOKUPVALUE function (DAX) - DAX | Microsoft Learn
Regard,
Xiaoxin Sehng
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 |
---|---|
111 | |
100 | |
80 | |
64 | |
58 |
User | Count |
---|---|
146 | |
110 | |
93 | |
84 | |
67 |