Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hello,
There are two tables in my database: one with transaction date and transaction value, as shown in the table below.
Second, dates table.
For every day in the chosen period (by dates table), I need to show values. If there is no transaction on some day, I should show the last transaction with its value.
I tried using some variations of function LASTNONBLANK without success.
I would appreciate your assistance.
link to PBIX :
PBIX last no blank
Date | sum | |
01/02/2023 | 3 | |
02/02/2023 | 5 | |
05/02/2023 | 6 | |
06/02/2023 | 7 | |
08/02/2023 | 8 |
Solved! Go to Solution.
Hi,
Please check the below picture and the attached pbix file.
Lastnonblank value: =
VAR _currentyear =
MAX ( DateTable[Year] )
VAR _lastnonblankyear =
CALCULATE (
LASTNONBLANK ( DateTable[Year], [totalValue] ),
FILTER ( ALL ( DateTable[Year] ), DateTable[Year] <= _currentyear )
)
RETURN
IF (
HASONEVALUE ( Suppliers[SupplierName] ),
CALCULATE ( [totalValue], DateTable[Year] = _lastnonblankyear )
)
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Thank you for your response.
I updated your code to
Hi,
Please check the below picture and the attached pbix file.
Lastnonblank value: =
VAR _currentyear =
MAX ( DateTable[Year] )
VAR _lastnonblankyear =
CALCULATE (
LASTNONBLANK ( DateTable[Year], [totalValue] ),
FILTER ( ALL ( DateTable[Year] ), DateTable[Year] <= _currentyear )
)
RETURN
IF (
HASONEVALUE ( Suppliers[SupplierName] ),
CALCULATE ( [totalValue], DateTable[Year] = _lastnonblankyear )
)
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Thank you for your response.
I updated your code to
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
130 | |
80 | |
53 | |
38 | |
35 |
User | Count |
---|---|
207 | |
83 | |
75 | |
55 | |
50 |