Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
i have a power bi report from two tables. the tables are different sales tables logging sales performance of every product on everyday. both two tables have a date column. and both of them have a sales amount column and a quantity column. i have two measures to calculate the total revenue by multiplying the qty and amount named revenue1 and revenue2. and i wanted to see the daily chnage in revenue, so i added two measures revenue1 prev day and revenue2 prev day to calculate the final two measures change in revenue1 and change in revenue2 by subtracting revenue from revenue prev day. the code for the prev day is like this:
revenue1 prev day = VAR CurrentDate = SELECTEDVALUE('sales1'[DATE])
Create a Date Table:
DateTable = CALENDAR(MIN('sales1'[DATE]), MAX('sales2'[DATE]))
Create Relationships:
DateTable[Date] → sales1[DATE]
DateTable[Date] → sales2[DATE]
Update Measures
revenue1 prev day =
VAR CurrentDate = SELECTEDVALUE(DateTable[Date]) // Use the date from DateTable
VAR LastWorkingDay =
CALCULATE(
MAX('sales1'[DATE]),
FILTER(
ALL('sales1'),
'sales1'[DATE] < CurrentDate
)
)
RETURN
IF(
NOT(ISBLANK(LastWorkingDay)),
CALCULATE([revenue1],'sales1'[DATE] = LastWorkingDay),
BLANK()
)
You would do something similar for the revenue2 prev day measure, ensuring it also references DateTable[Date].
Create Change in Revenue Measures:
Change in Revenue1 = [revenue1] - [revenue1 prev day]
Change in Revenue2 = [revenue2] - [revenue2 prev day]
Now, create a line or bar chart. Use the DateTable[Date] for the X-axis. Drag both Change in Revenue1 and Change in Revenue2 measures onto the Values field of the chart.
If this helped, a Kudos 👍 or Solution mark would be great!🎉
Cheers,
Kedar Pande
Connect on LinkedIn
i already tried this as in the post i said i made a new date table with dax code. i made the one to many relationship and changed the previous day revenue measure with what you suggested. but this doesnt show any value at all in the chart when placed against the date column from new date table. do you know any other trick or what might be the problem?
share the file, please. upload in drive and share link here
hey did you get to check my file? i shared the link to the file. and please inform me whether you do or do not know the solution for this. thanks
okay i made a small version of the report for sharing purpose. the actual names are a bit different from what i described here, i think you would neglect this. the stated visual is the second chart on page 1 and i left some other visuals to show the codes are working on other charts and for taking a look at actual values real quick. here is the link:
https://drive.google.com/file/d/1YndDKyuC_Do0F5wLLAkCXiGKHz7NFgJ4/view?usp=sharing
Hi @xangetsu21 - create a common Date Table and bring the relationships to both sales1 and sales2, the date context is synchronized across both tables.
The Prev Day measures are updated to use the same DateTable[Date], ensuring consistency when calculating previous day revenue across both tables.
The final result allows you to plot both Change in revenue1 and Change in revenue2 on the same chart using the shared date axis.
Link the DateTable[Date] column to the DATE column in both sales1 and sales2. This will be a one-to-many relationship from DateTable to each sales table.
DateTable = CALENDAR(MIN('sales1'[DATE]), MAX('sales1'[DATE]))
create a measure
revenue1 prev day =
VAR CurrentDate = SELECTEDVALUE('DateTable'[Date])
VAR LastWorkingDay =
CALCULATE(
MAX('sales1'[DATE]),
FILTER(
ALL('sales1'),
'sales1'[DATE] < CurrentDate
)
)
RETURN
IF(
NOT(ISBLANK(LastWorkingDay)),
CALCULATE([revenue1], 'sales1'[DATE] = LastWorkingDay),
BLANK()
)
For revenue2 prev day
revenue2 prev day =
VAR CurrentDate = SELECTEDVALUE('DateTable'[Date])
VAR LastWorkingDay =
CALCULATE(
MAX('sales2'[DATE]),
FILTER(
ALL('sales2'),
'sales2'[DATE] < CurrentDate
)
)
RETURN
IF(
NOT(ISBLANK(LastWorkingDay)),
CALCULATE([revenue2], 'sales2'[DATE] = LastWorkingDay),
BLANK()
)
You can now calculate the change in revenue
Change in revenue1 = [revenue1] - [revenue1 prev day]
Change in revenue2 = [revenue2] - [revenue2 prev day]
Hope the above calculation helps
Proud to be a Super User! | |
i already tried this as in the post i said i made a new date table with dax code. i made the one to many relationship and changed the previous day revenue measure with what you suggested. but this doesnt show any value at all in the chart when placed against the date column from new date table. do you know any other trick or what might be the problem?
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.