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!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
hello all,
please, i have a measure to calculate the average quantity in stock by month, the problem is when there is no transaction for a product in a month (on sales_tab) it doesn't give me any value, i want to give me the latest value
here is my measure:
Solved! Go to Solution.
| Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! |
DAX is simple, but NOT EASY! |
Hi @Sofinobi
If the added values shall be counted in the total, you may try this as per attached sample file.
Average Filldown =
AVERAGEX (
VALUES ( 'Date'[YearMonth Number] ),
VAR CurrentMonth = 'Date'[YearMonth Number]
VAR LastDateWithData =
MAXX (
FILTER (
CALCULATETABLE ( VALUES ( Sales_Tab[CreationDate] ), ALL ( 'Date' ) ),
FORMAT ( Sales_Tab[CreationDate], "YYYYMM" ) <= CurrentMonth
),
Sales_Tab[CreationDate]
)
VAR LastMonthWithData = FORMAT ( LastDateWithData, "YYYYMM" )
RETURN
CALCULATE (
AVERAGE ( Sales_Tab[OldLogicalQuantity] ),
'Date'[YearMonth Number] = LastMonthWithData,
ALL ( 'Date' )
)
)
| Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! |
DAX is simple, but NOT EASY! |
thank you my friend
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 20 | |
| 10 | |
| 9 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 33 | |
| 31 | |
| 19 | |
| 12 | |
| 11 |