Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Dear Community,
I stuck on issue how to show previous date data on matrix table.
I made matrix table showing qty each day from plant A and B. I want to make it as showing in second picture with high-lighting the part in yellow. Basically 11/3 is missing so it needs to be added by using the data from 11/2. Also Plant A 11/6 qty should be from 11/5 and plant B 11/2 data to be from 11/1. How can we make it? Thanks for help!
Solved! Go to Solution.
Hi @nbufff ,
You can produce your required output by writing a dax measure like below:
Date_Diff =
VAR StartDate = DATE(2024, 11, 1) -- Starting point
VAR CurrentDate = SELECTEDVALUE(Calendar[Date])
RETURN
IF(
CurrentDate >= StartDate,
CALCULATE(
COUNTROWS('Calendar'),
FILTER(
ALL('Calendar'),
Calendar[Date] >= StartDate &&
Calendar[Date] <= CurrentDate &&
Calendar[IsWorkingDay] = 1
)
),
BLANK() -- If the date is before November 1, return blank
)
The resulting output is shown below. I've transposed the visualization to save space.
I have attached an example pbix file for your reference.
Best regards,
Hi @nbufff ,
You can produce your required output by writing a dax measure like below:
CarryOverQty =
VAR CurrentDate = SELECTEDVALUE(Calendar[Date])
VAR PreviousQty =
CALCULATE(
MAXX(
FILTER(
ALL('Calendar'),
Calendar[Date] < CurrentDate && NOT(ISBLANK([Quantity]))
),
[Quantity]
)
)
RETURN
IF(
ISBLANK([Quantity]),
PreviousQty,
[Quantity]
)
The data model will look like below:
The resulting output will look like as follows:
I have attached an example pbix file for your reference.
Best regards,
@DataNinja777 , I tried your formual in my case. it works on most data but some data seemed weir.
from below screen you can see on 11/21 there's carryover data 52550 which accordig to your method should be 1800 since actually there's no data on that day.
There's few other colum also encountered such issue.
I also show you the table view screen shot for your reference. Pls kindly advise if I can improve.
carryover_mavqty =
VAR currentdate=SELECTEDVALUE(Calendar_Table[Date])
VAR previousqty =
CALCULATE(
MAXX(
FILTER(
ALL(Calendar_Table),
Calendar_Table[Date] < currentdate && NOT(ISBLANK([sum_mavqty]))
),
[sum_mavqty]
)
)
RETURN
IF(
ISBLANK([sum_mavqty]),previousqty,[sum_mavqty])
@DataNinja777 , It works but the situation here little bit complex.
we need to by pass the holdaiy and get the date difference between working days.
e.g. we don't need to show Nov.2 and Nov.3 but we need to show working day difference from Nov.1
thank for advise.
Hi @nbufff ,
You can produce your required output by writing a dax measure like below:
Date_Diff =
VAR StartDate = DATE(2024, 11, 1) -- Starting point
VAR CurrentDate = SELECTEDVALUE(Calendar[Date])
RETURN
IF(
CurrentDate >= StartDate,
CALCULATE(
COUNTROWS('Calendar'),
FILTER(
ALL('Calendar'),
Calendar[Date] >= StartDate &&
Calendar[Date] <= CurrentDate &&
Calendar[IsWorkingDay] = 1
)
),
BLANK() -- If the date is before November 1, return blank
)
The resulting output is shown below. I've transposed the visualization to save space.
I have attached an example pbix file for your reference.
Best regards,
Try
Including Missing Dates =
COALESCE (
[Base Measure],
VAR MaxDate =
MAX ( 'Date'[Date] )
VAR Result =
LASTNONBLANKVALUE (
FILTER ( ALL ( 'Date'[Date] ), 'Date'[Date] < MaxDate ),
[Base Measure]
)
RETURN
Result
)
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
10 | |
10 | |
10 | |
9 | |
7 |
User | Count |
---|---|
17 | |
12 | |
11 | |
11 | |
10 |