0 votes
I've a scenario, I need to calculate average inventory per months where we have formula of average inventory is (beginning inventory + closing inventory)/2. if I select any month, then the beginning inventory should have the inventory amount of selected month and closing inventory should have the inventory amount of the last month. After that we will use the above listed formula for calculation. Can anyone help me to achieve this end result in power bi? Sep 28, 2020 in Power BI 354 views

## 1 answer to this question.

0 votes

Hi @There,

Is there any index field in your table? If this is a case, you can write a formula to use the index to find out the corresponding begin value and end value, then use them to get the average.

```AVG Measure =
VAR _start =
MINX ( ALLSELECTED ( Table[index] ), [index] )
VAR _end =
MAXX ( ALLSELECTED ( Table[index] ), [index] )
RETURN
DIVIDE (
LOOKUPVALUE ( Table[Amount], Table[index], _start )
+ LOOKUPVALUE ( Table[Amount], Table[index], _end ),
2,
BLANK ()
)```

Otherwise, you need to add an index column first.(power bi data model does not contain a row/column index to find out first or last row value).

Hope this helps!! answered Sep 28, 2020 by
• 65,870 points

0 votes
1 answer

## To Calculate the Standard Deviation in Power BI

Suppose you've to obtain the Standard Deviation ...READ MORE

0 votes
1 answer

## How to combine your data or tables in Power BI?

Power BI includes Query Editor which is ...READ MORE

0 votes
1 answer

## How to Install Power BI in Windows

Hi, Anitha Go to this Link https://powerbi.microsoft.com/en-us/downloads/ Then click on ...READ MORE

0 votes
3 answers

## How to create final table based on Joins of two tables in power BI?

To do so, follow these steps: From the ...READ MORE

0 votes
1 answer

## Displaying Table Schema using Power BI with Azure IoT Hub

Answering your first question, Event Hubs are ...READ MORE

+1 vote
1 answer

## Unable to install connector for Power Bi and PostgreSQL

I think the problem is not at ...READ MORE

+2 votes
2 answers

## Migrate power bi collection to power bi embedded

I agree with Kalgi, this method is ...READ MORE

+1 vote
1 answer

## Connect power bi desktop to dataset and create custom reports

Yes using Power BI REST API to ...READ MORE

0 votes
1 answer

## Using DAX calculation how to calculate monthly budget till today in power bi Desktop?

You can make use of this: MTD Budget ...READ MORE

0 votes
1 answer

## How to measure in DAX to calculate YTD for chosen month only for Power BI?

If you use the date column from FactTable, ...READ MORE