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.
Hello Community and Thank you for your guidance ,
I have sales of customer by Month He could have 0 sales for a month I want to replace it with the sales of the previous Month in Power BI is it possible ?
Cust | Sales | Month |
A | 0 | 5-2021 |
A | 1000 | 4-2021 |
A | 0 | 3-2021 |
A | 1200 | 2-2021 |
the result
Cust | Sales | Month |
A | 1000 | 5-2021 |
A | 1000 | 4-2021 |
A | 1200 | 3-2021 |
A | 1200 | 2-2021 |
Best Regards
Solved! Go to Solution.
@Anonymous , Create a date like
Date = "01-" &[Month]
then try a new column
new column =
if([Sales] =0 ,sumx(filter(Table, eomonth([Date],0) = eomonth(earlier([Date]),-1)),[Sales]),[sales])
or measure using time intelligence
MTD Sales = CALCULATE([Sales],DATESMTD('Date'[Date]))
last MTD Sales = CALCULATE([Sales],DATESMTD(dateadd('Date'[Date],-1,MONTH)))
if(isblank([MTD Sales]), [last MTD Sales],[MTD Sales])
Hi all thank you for your suggestion . I tried your formula but i get this result :
the amount of sales in june shoud be equal to May and for each Client it should be different I Get the same amount for different Client if the sales = 0
Do you have any idea
and thank for this community
Hi @amitchandak , thank your for youe suggestion , I tried the formula i get the same result Sum all the sales of previous month for all client .
Do you any idea How to correct it
best Regards
Hi @Anonymous ,
Modify the measure as below, add client condition.
Column = IF('Table'[Sales]=0,CALCULATE(SUM('Table'[Sales]),FILTER('Table','Table'[Date]=EDATE(EARLIER('Table'[Date]),-1)&&'Table'[Client]=EARLIER('Table'[Client]))),'Table'[Sales])
Best Regards,
Jay
Thank You all for your help . Great Community
Hi @Anonymous ,
There might be many options depending on your model, prerequisites and requirements.
Do you need a measure or a calculated column?
If this post helps, then please consider Accept it as the solution ✔️to help the other members find it more quickly.
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your Kudos.
Check out my latest demo report in the data story gallery.
Stand with Ukraine!
Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/
Thank you!
Hi @Anonymous ,
Check the formula.
Column = IF('Table'[Sales ]=0,CALCULATE(SUM('Table'[Sales ]),FILTER('Table','Table'[Month ]=EDATE(EARLIER('Table'[Month ]),-1))),'Table'[Sales ])
Best Regards,
Jay
Hi all thank you for your suggestion . I tried your formula but i get this result :
the amount of sales in june shoud be equal to May and for each Client it should be different I Get the same amount for different Client if the sales = 0
Do you have any idea
and thank for this community
Hi @Anonymous ,
Modify the measure as below, add client condition.
Column = IF('Table'[Sales]=0,CALCULATE(SUM('Table'[Sales]),FILTER('Table','Table'[Date]=EDATE(EARLIER('Table'[Date]),-1)&&'Table'[Client]=EARLIER('Table'[Client]))),'Table'[Sales])
Best Regards,
Jay
@Anonymous , Create a date like
Date = "01-" &[Month]
then try a new column
new column =
if([Sales] =0 ,sumx(filter(Table, eomonth([Date],0) = eomonth(earlier([Date]),-1)),[Sales]),[sales])
or measure using time intelligence
MTD Sales = CALCULATE([Sales],DATESMTD('Date'[Date]))
last MTD Sales = CALCULATE([Sales],DATESMTD(dateadd('Date'[Date],-1,MONTH)))
if(isblank([MTD Sales]), [last MTD Sales],[MTD Sales])
Hi @amitchandak , thank your for youe suggestion , I tried the formula i get the same result Sum all the sales of previous month for all client .
Do you any idea How to correct it
best Regards
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 |
---|---|
114 | |
97 | |
85 | |
70 | |
61 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |