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 all,
I have a problem that I'm handling nowadays.
As you can see in the picture below, there are some order amounts that come empty. As in the example below, in the data set of order amounts, there are no records for the dates 18.03.2022, 19.03.2022, 20.03.2022 and 21.03.2022. However, I need to print the previous value instead of the empty order amounts. I developed a formula for this as follows. However, this formula creates a performance problem. The report's performance has slowed. Do you have any other suggestions in this situation?
Solved! Go to Solution.
@bburcu
Please try
Siparis miktarı güncel =
VAR CurrentDate =
MAX ( 'Tarih'[Tarih] )
VAR LastRecordsWithData =
CALCULATETABLE (
TOPN ( 1, 'Table', 'Table'[Kayet tarihi] ),
ALL ( 'Tarih' ),
'Tarih'[Tarih] < CurrentDate
)
VAR PreviousValue =
SUMX ( LastRecordsWithData, 'Table'[Sipariş mikt.] )
RETURN
COALESCE ( [Measure], PreviousValue )
VAR PreviousRow = CALCULATE( IF(isblank([Order Amount]), OFFSET( -1, ALLSELECTED('Table'[Order Amount]), ORDERBY('Table'[Order Amount], ASC) ) ))
@bburcu If this post helps, please consider accept as solution to help other members find it more quickly.
Thank you for your answer but it doesn't work. Also I modified your measure and just one row (18.03.2022) is work. You can see in below picture.
Hi @bburcu
Which column are you placing in the columns of the matrix? From which table?
Date info of rows are from date table which created query.
"Hafta" info of columns are from Table (main dataset). There are no some records in the main table but appear the blanks rows relational with date table.
Two date info especially weeks are different each other.
Please try
Siparis miktarı güncel =
VAR LastRecordsWithData =
CALCULATETABLE (
TOPN ( 1, 'Table', 'Table'[Tarih] ),
ALL ( 'Tarih' ),
VALUES ( 'Tarih'[Hafta] )
)
VAR PreviousValue =
SUMX ( LastRecordsWithData, 'Table'[Sipariş mikt.] )
RETURN
COALESCE ( [Measure], PreviousValue )
I'm trying COALESCE function return 1 instead of blank values. "PreviousValue" doesn't work obviously 😞
Please look closely at my code and notice when I use 'Table' and when I use 'Tarih'
Also I sid not use [Measure] inside SUMX rather I used the column reference directly. Please try exactly as proposed and let me know if it works.
It's work but there is an another problem 🙂
week 12 should be continue with 20, is there any suggestion for this issue?
@bburcu
Please try
Siparis miktarı güncel =
VAR CurrentDate =
MAX ( 'Tarih'[Tarih] )
VAR LastRecordsWithData =
CALCULATETABLE (
TOPN ( 1, 'Table', 'Table'[Kayet tarihi] ),
ALL ( 'Tarih' ),
'Tarih'[Tarih] < CurrentDate
)
VAR PreviousValue =
SUMX ( LastRecordsWithData, 'Table'[Sipariş mikt.] )
RETURN
COALESCE ( [Measure], PreviousValue )
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 |
---|---|
47 | |
26 | |
19 | |
14 | |
10 |
User | Count |
---|---|
58 | |
50 | |
44 | |
19 | |
18 |