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.
Hi Guys,
I used below dax to get previous sales amount; but i get blank amount
Solved! Go to Solution.
Hi @sneevand ,
You also could use the following measure:
Step 1, create a new column:
last month = DATEADD(Invoice[MonthValue],-1,MONTH)
Step 2 ,use the following dax to create a measure:
salelastmonth =
VAR last1 =
CALCULATE (
MAX ( Invoice[saleamount] ),
FILTER ( ALL ( Invoice ), Invoice[MonthValue] = MAX ( Invoice[last month] ) )
)
VAR last2 =
IF ( MAX ( Invoice[last month] ) = BLANK (), "first month", last1 )
RETURN
last2
final you will get below:
Click here to download pbix if you need.
Best Regard
Lucien Wang
Hi @sneevand ,
You also could use the following measure:
Step 1, create a new column:
last month = DATEADD(Invoice[MonthValue],-1,MONTH)
Step 2 ,use the following dax to create a measure:
salelastmonth =
VAR last1 =
CALCULATE (
MAX ( Invoice[saleamount] ),
FILTER ( ALL ( Invoice ), Invoice[MonthValue] = MAX ( Invoice[last month] ) )
)
VAR last2 =
IF ( MAX ( Invoice[last month] ) = BLANK (), "first month", last1 )
RETURN
last2
final you will get below:
Click here to download pbix if you need.
Best Regard
Lucien Wang
Hi @sneevand ,
You calculation is correct. You might try to mark your date table as Date table or to check calculations on this link:
https://community.powerbi.com/t5/Desktop/Previous-Month-show-blank/m-p/1401555
If it doesn't help, could you share the file (create dummy data, but keep the structure - tables, relationships, calculations).
Regards,
Nemanja Andic
Hi @nandic
below approach worked but on every year first month, Salespreviousmonth is blank 🙂
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 |
---|---|
113 | |
99 | |
80 | |
70 | |
59 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |