This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreLevel up your Power BI skills this month - build one visual each week and tell better stories with data! Get started
Hello,
I'm in a bit of a pickle and can't figure out how to compare data values. Image for refference.
What I would like to do is to compare the names (left) with the values based upon dates. E.g.
Akrylux -124.90 - 11/10/2017 has increased by 26% on the date 2/28/2018. Just calculate a simple growth rate.
growth= (present-past)/past
And then monthly - however some months dont have data - empty. Is there a way to treat those empty months as 0? And then show current month growth as 0? With the last growth figure by its side - with the last growth date?
The picture above is a Visualation (table) with the selected fields. name - sales - date.
Thank you for inputs.
Regards,
David.
Solved! Go to Solution.
Hi @Anonymous,
Please try to add calculated columns with below DAX:
past =
LOOKUPVALUE (
Tb2[Values],
Tb2[Names], Tb2[Names],
Tb2[Dates], CALCULATE (
MAX ( Tb2[Dates] ),
FILTER ( ALLEXCEPT ( Tb2, Tb2[Names] ), Tb2[Dates] < EARLIER ( Tb2[Dates] ) )
)
)
growth =
IF ( Tb2[past] = BLANK (), 0, ( Tb2[Values] - Tb2[past] ) / Tb2[past] )
And then monthly - however some months dont have data - empty. Is there a way to treat those empty months as 0? And then show current month growth as 0? With the last growth figure by its side - with the last growth date?
I cannot understand above requirement well, please illustrate your desired result with more details.
Best regards,
Yuliana Gu
Hi @Anonymous,
Please try to add calculated columns with below DAX:
past =
LOOKUPVALUE (
Tb2[Values],
Tb2[Names], Tb2[Names],
Tb2[Dates], CALCULATE (
MAX ( Tb2[Dates] ),
FILTER ( ALLEXCEPT ( Tb2, Tb2[Names] ), Tb2[Dates] < EARLIER ( Tb2[Dates] ) )
)
)
growth =
IF ( Tb2[past] = BLANK (), 0, ( Tb2[Values] - Tb2[past] ) / Tb2[past] )
And then monthly - however some months dont have data - empty. Is there a way to treat those empty months as 0? And then show current month growth as 0? With the last growth figure by its side - with the last growth date?
I cannot understand above requirement well, please illustrate your desired result with more details.
Best regards,
Yuliana Gu
When trying the dataset which is computed manually @v-yulgu-msft it works like a charm! But the issue still persists with that error in a normal table.
Thank you for your response @v-yulgu-msft, however the callculated collumn shows me this error.
"A table of multiple values was supplied when a single value was expected"
Could the issue be that my NAMES (company) are related from another collumn and my vallues(margin real) are callculated collumn as well?
Regarding the monthly growth what I would like to do is a moving average of monthly/ 3 months/ 6 months.
I think I know how to do it (DAX below). But would like to do it by the Company (NAMES in your pbix). Not that advanced in DAX when it comes towards this.
Moving 3 AVG =
CALCULATE (
AVERAGE ( Orders[Margin Real] );
DATESINPERIOD (
Orders[actual_delivery_date];
LASTDATE ( Orders[actual_delivery_date] );
-3;
MONTH
)
)
Thank you for your help and time @v-yulgu-msft.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 31 | |
| 24 | |
| 23 | |
| 20 | |
| 16 |
| User | Count |
|---|---|
| 63 | |
| 38 | |
| 28 | |
| 23 | |
| 22 |