I would like to get the no of outlet on volume growth, an outlet is on volume growth if YTD volume > Last YTD volume.
Currently I have two measurements [YTD Volume] and [Last YTD Volume].
How should I write the formula to get the no of outlet on volume growth
No of outlet on volume growth :=
SUMX (
SUMMARIZE (
'Invoice',
[Outlet],
"count", IF ( [YTD Volume] > [Last YTD Volume], 1, 0 )
),
[count]
)
Related
I hope someone can help. I am stuck.
Below are two different DAX functions to calculate my averages.
The first one (Average Coalesce function) gives me the precise results with full data e.g. Q1 & Q2 2022, but it doesn't calculate the quarters correctly as e.g Q3 this year. I do not have data for August/September.
The second Average Connector Usage is not as precise in the result but it calculates the Quarter averages correctly.
It all started with my base function to crete further formulas:
SDR ID average per CP ID =
AVERAGEX(
KEEPFILTERS(VALUES('FACT TABLE'[CP ID])),
CALCULATE(COUNTA('FACT TABLE'[SDR ID]))
)
SDR ID is my unique transaction number and CP ID is my unique location number.
I have tried many measures and these two are the closest to return correct results.
No.1.
Average COALESCE =
IF (
NOT ISEMPTY ( 'FACT TABLE' ),
AVERAGEX (
VALUES ( 'Calendar'[Date] ),
COALESCE ( [SDR ID average per CP ID], 0 )
)
)
No.2.
Average Connector Usage =
IF (
NOT ISEMPTY ( 'FACT TABLE' ),
VAR minDate =
MIN ( 'FACT TABLE'[Start Date] )
VAR maxDate =
MAX ( 'FACT TABLE'[Start Date] )
RETURN
CALCULATE (
AVERAGEX (
VALUES ( 'Calendar'[Date] ),
COALESCE ( [SDR ID average per CP ID], 0 )
),
DATESBETWEEN ( 'Calendar'[Date], minDate, maxDate )
)
)
These are the results.
Date & Connector
Average COALESCE
Average Connector Usage
2022
1.54
2.31
Q2
2.35
2.35
Rapid
2.35
2.35
AC
0.19
0.21
CCS
1.89
1.89
ChaDeMo
0.27
0.28
Q3
0.74
2.19
Rapid
0.74
2.19
AC
0.04
0.27
CCS
0.57
1.68
ChaDeMo
0.13
0.40
In PowerBI, I want to compare the value growth of categories (lets take A and B) over time from any starting year. To compare this easily, I am using a line graph with the time on the x-axis and category as a legend. I would like both categories to start at 100% and show the growth relative to that starting point. I then want to be able to use a continuous date slicer to vary the start and end-points of my line graph.
I've created a dummy data to illustrate this
Category, Year, Value
A 2000 5
A 2001 8
A 2002 8
A 2003 10
B 2000 10
B 2001 8
B 2002 12
B 2003 10
Without any date filter, I would like to display years 2000-2003 with the following values for the lines:
A: 100%, 160%, 160%, 200%
B: 100%, 80%, 120%, 100%
(The first value of category A is 5. Therefore the line graph should display A's values relative to 5. It's values 5, 8, 8, 10 are then displayed as the mentioned percentages. The first value of category B is 10, so B's values should be displayed relative to 10).
With a date slicer set to filter years 2001-2003, I want the line values to become:
A: 100%, 100%, 125%
B: 100%, 150%, 125%
(Due to the slicer the first value of category A is 8, so I want the % values relative to 8. The first value of B is also 8)
I was thinking of writing a measure for this. Can anyone help me with it? Thank you in advance.
You can create a measure to establish the earliest filtered year, the value for that year, then divide each evaluated value by the min year value:
MyMeasure =
VAR MinYear =
CALCULATE (
MIN ( MyTable[Year] ),
ALLSELECTED ( MyTable[Year] )
)
VAR BaseValue =
CALCULATE (
SUM ( MyTable[Value] ),
REMOVEFILTERS ( MyTable[Year] ),
MyTable[Year] = MinYear
)
VAR CurrentValue =
SUM ( MyTable[Value] )
RETURN
DIVIDE (
CurrentValue,
BaseValue
)
Which results in:
I have repeatedly ran into the following problem when calculating variances, that the grand totals are calculated wrong. Although they are not technically wrong, I want to calculate them differently. The picture below shows what I have constructed in PowerPivot.
Formulas:
ACT Sales EUR = CALCULATE([Sales EUR];FILTER(data;data[Type] = "ACT"))
ACT Sales/kg = DIVIDE([ACT Sales EUR];[ACT Sales KG])
FC Sales/kg = DIVIDE([FC Sales EUR];[FC Sales KG]
Quantity Variance = ([ACT Sales KG] - [FC Sales KG]) * [FC Sales/kg]
Price Variance = ([ACT Sales/kg] - [FC Sales/kg]) x [ACT Sales KG]
The total variance is equal to column [Sales ACT vs FC EUR], but I would like the grand total for the variances to be a simple sum of the rows, and not using the measure formula on the grand total. How should this be done correctly?
The column structure for the data is as follows (where Type is either ACT, BUD, FC):
| Date | Type | Product | EUR | KG |
To fix variance totals, you need to iterate over product and then sum up the results:
Quantity Variance = (
SUMX(
VALUES( Data[Product]),
[ACT Sales KG] - [FC Sales KG]) * [FC Sales/kg]
)
(same for the other variance)
I need to solve a financial math problem. I have a revenue goal set based on target company growth rate. Given this total revenue goal for next year, I need to set sales goals each month that have the growth rate (monthly) applied to them. They will total the annual revenue goal. What this looks like is contributions that increase every occurrence by a set rate. Once I determine either the first or last month's goal, I can discount back or find the future values easily.
The problem I have is that I know what these goals need to total, but not what the first or last goal would equal. Hypothetically, I supposed I could use the mean goal (annual goal/12) to give me the goal for the middle of the year and discount back and scale up from June. However, since there is a growth rate, the compounding causes exponential rather than linear growth of the goals. What kind of formula can I use to solve this? Would I treat this as ongoing (but changing) contributions toward an investment with a set future value and growth rate? Or is there some sort of Goal Solver functionality that will help? I am currently doing this in Google Sheets but can switch to Excel or another medium. (I use R heavily, so not afraid of some programmatic methods).
If I cannot figure this out, I will just apply a linear function to it and use the difference in revenue each year as the slope.
Approach:
Let's assume your business starts in Sep-2017, a Month 0, with S units sold.
The constant growth rate, for each next month, was defined in your Business Case as a q, equal to 8% ( 1.08 )
Month 0: S [units], be it 1, 3 or 76,538,112,257
Month 1: S * q
Month 2: S * q * q
Month 3: S * q * q * q
..
Month 11: S * q * q * q * ... * q
>>> S = 1
>>> q = 1.08
>>> [ S * ( q ** i ) for i in range( 12 ) ]
[ 1.0,
1.08,
1.1664,
1.2597120000000002,
1.3604889600000003,
1.4693280768000005,
1.5868743229440005,
1.7138242687795209,
1.8509302102818825,
1.9990046271044333,
2.158924997272788,
2.331638997054611
]
The S units "Scale-free" sum ( independent on the initial amount )
help determine the relation between the target T units sold in total and any S, given q
>>> sum( [ S * ( q**i ) for i in range( 12 ) ] )
18.977126460237237
Here one can see, how inaccurate would be any attempt to use averages and similar guesses to approximate the progress of the powers of q during the period of compounding a constant growth rate ( yielding a T of ~ 19 x the S over 12 months at a given constant rate q of just 8% -- do not hesitate to experiment with other values of q to see the effect sharper and sharper ).
So for an example of a total T of 19,000 units sold during the Year 0, keeping the growth rate of 8% p.m.:
The initial seed for S would be a target T divided by the sum of ( constant growth ) scaling coefficients:
T / sum( [ S * ( q**i ) for i in range( 12 ) ] )
To be on the safer side,
>>> int( 1 + T / sum( [ S * ( q**i ) for i in range( 12 ) ] ) )
1002
>>> sum( [ 1002 * ( q**i ) for i in range( 12 ) ] )
19015.08 ...
>>> [ int( 1002 * ( q**i ) ) for i in range( 12 ) ]
[ 1002,
1082,
1168,
1262,
1363,
1472,
1590,
1717,
1854,
2003,
2163,
2336
]
Month 0: S ~ 1,002 [units]
Month 1: S * q ~ 1,082
Month 2: S * q * q ~ 1,168
Month 3: S * q * q * q ~ 1,262
.. ~ 1,363
. ~ 1,472
~ 1,590
~ 1,717
~ 1,854
. ~ 2,003
.. ~ 2,163
Month 11: S * q * q * q * ... * q ~ 2,336
_____________________________________________________________
19,012 [unit] per Year 0
So Good Luck & Go Get It Sold!
I need to sum the values of column resulting from the table resulting from Summarize Funtion.
For e.g. my Data Set 'Tab' is like this
Type Value
A 10
A 10
A 10
B 20
B 20
B 20
C 30
C 30
C 30
The result from Summarize(Tab,[Type],AVG([Value])) will be like following
A 10
B 20
C 30
And the final result required from this result set is 10+20+30 i.e. 60.
Please help
You can use SUMX function.
Sum of Avg =
SUMX (
SUMMARIZE ( Tab, [Type], "Total Average", AVERAGE ( Tab[Value] ) ),
[Total Average]
)
It will give you the total if there is not any Type context affecting the measure:
Let me know if this helps.
You need to declare a name for it.
Total Value = Summarize(Tab,'Tab'[Type],"Total value",SUM('Tab'[Value])