Inventory database with calculated incremental values from movements by date - powerbi

I am tring to recreate an inventory database in which, by COD_ART, there is the stock value by date.
I have the data shown in picture A. The "inventory column" rapresent today inventory value while the "Movement" column rapresent the increased/deacreased value by date.
I would like to have a new column with the incremental quantity:
14/10/2021 | 925
13/10/2021 | 933
30/09/2021 | 733
etc.
Can anyone help me?
Thank you in advance for any suggestion.

What you're looking for is called "Running Total" and its better to create a Measure than to create a Column, because technically speaking if you have multiple rows for same date, then running total in a column gets tricky. Also learning measures will be a really good skill under your belt.
And PowerBI has simplified creating this measure by adding the Quick Measure feature.
You can check out this video starting at 6:41 to get an understanding of how this works.
Steps:
Right-Click on stock-value column and select "New Quick measure"
In Calculation drop-down, select "Running Total"
If you right-clicked on the stock-value column, PowerBI will automatically add that column to "Base Value" field
Drag the date field into the "Field" section
Choose Ascending - which is selected by default.
Click Ok
Now the measure will be added to your table and you can create a table using this measure.

Related

How to remove the empty rows in the table in PowerBI?

Hi all,
I have a table in PowerBI as shown in the screenshot above. I want to remove the rows in the table where column D is empty. So in the example above, the rows that should be removed are row7,8,9,10. In Power Query Editor, I'm only able to remove the rows if the entire row is empty.
May I know how should I remove row 7-10 in PowerBI? In future, if the data for row 7-10 in column D are available, then it will be restored back. Is this possible to achieve? Any help or advice will be greatly appreciated!
You can do as #Jeroen Mostert mentioned in his comment, within Power Query, or if you are just trying to display the table as a table visual in Power BI like this...
...then you could just filter the table visual by the column with blanks within Power BI without doing anything in Power Query.
To filter the table visual:
select the table visual
then, in the Filters pane, find the section about your column named Final, and then select "is not blank" from the drop-down selection below "Show items when the value"
then click Apply filter.
This screen snip shows the table visual selected and the Filters pane visible with "is not blank" selected in its drop-down.

In Power BI, how can I create a column that changes based on a slicer and visualization?

I'm pretty new to Power BI. I'm unsure how to approach this.
I have one visualization that displays the ten most frequently bought products in a time frame that is set by a slicer. In another visualization, I display how those products have been selling over the past few years (this time frame is not determined by the slicer). I want to display only the ten products that come from the first visualization, not the ten most common over the time frame in the second visualization.
How can I accomplish this? The approach I have in mind (and I'm open to others) is to create a true/false column that changes with the first visualization. "True" would be for products that are frequently bought as determined by the first visualization in the slicer-determined time range, and the second visualization would only look at values with a "true" in that column. How can I create a column (or table, maybe?) that changes depending on a visualization?
Clarification: most of the pages will say Top10 ... Actually, the measure used was a simple Top5 that includes products with the same number of orders than the 5th product. Therefore, to avoid dealing with larger images, 7 products will be seen but it is a Top5 ranking. The idea is you can replace it with your custom TopN measure.
What I understood:
The simplification of your model plus the disconnected help table would be:
I have one visualization that displays the ten most frequently bought
products in a time frame that is set by a slicer.
The Date slicer belongs to the Dates table in the Data model.
The table viz represents the number of rows in the sales table in the
current context (for each product within the Date range).
The table viz is sorted according to the [#Rows] measure in descending
order.
The table viz only presents the TopN products even without the presence
of the [#Rows] measure due to the presence of the [TopOrders]
measure within Filters on this visual. [TopOrders] is 1.
On the second page you create:
A slicer with the Dates[Date] column (the same one used on the
previous page).
A matrix with Products[ProductName] on the rows, HDates[Year] on
the columns, and a measure on values.
From the View tab, you select the Sync Slicers option.
Inside the Sync Slicers pane:
In the Sync column, check the boxes related to the necessary pages.
In the Display column uncheck the box that contains the over
years report.
So far all we have done is pass the time frame context from page 1 to page 2.
Since the TopN context depends on the time frame context, we can now use the [TopOrders] measure as a Filters on this visual in the matrix. Again, [TopOrders] is 1.
Why do the numbers differ between rows and not between columns?
Also, in this example, the Sales table only has information up to 12/31/2020 but the visualization shows an additional year and the Sales[Amount] values for each order is $1 so that [#Orders] and [SalesAmount] are the same for easy comparison.
HDates is not related to the model and for each combination of HDates[Year]-Products[ProductName], the [SalesAmount] measure is using the information coming from the previously hidden slicer and the respective Products[ProductName] because the information coming from HDates[Year] has no effect yet.
In order to complete this exercise, it only remains to modify the [SalesAmount] measure in such a way that it removes the filter on the time frame (Dates[Date]) and it recognizes HDates[Year] as Dates[Year].
SalesAmount :=
CALCULATE(
SUM(Sales[Amount]),
ALL(Dates),
TREATAS(VALUES(HDates[Year]),Dates[Year])
)
And this is the final result.
I hope it works for someone or the idea can be improved.

Summation of rows based on Dropdown selection in Power BI

I have a dropdown in Power BI that contains different project name such as Project One, Two, Three. I have included one formula to bring forecast value which is:
Forecast = Chase * Target%
I have created one measure that calculates forecast. The dataset contains weekly based data for Chase and Target %. For example week 1 (Jan 01-Jan 08) Chase will be 30 and target % as 10 hence the forecast for Week 1 is 3 (30*10%)
When I select one project from dropdown list e.g. "Project One" I see the forecast value populating correctly. Same goes if I select only one project from dropdown list .
The issue arises when I select multiple projects and then the forecast value brings the maximum value instead of bringing summation to the values of all weeks of all projects.
Question: What exactly is causing the issue?
Now I understand your requirement from your comments. You can achieve this through 2 step as explained below-
Step-1: Create a custom column in your data source as below-
row_level_forecast = finetarget[chase]/100.00 * finetarget[target]
Step-2: Create the final Measure as below-
forecast = sum(finetarget[row_level_forecast])
Now, use measure "forecast" in the report. This should give you the desired output.
ISSUE-2: From your comments
If I understand correct, you are talking about a case where you are concern about values in columns I marked red in the below picture-
If I am correct with my understanding, you wants to fill week-3 values for Project-1 with 80/70 and for Project-2 100/90. If this is ok, just follow these following steps.
Step-1: Go to EDIT mode clicking "Transform Data" option and select the table you wants to adjust data.
Step-2: Sort your data first for project_name (ascending) then week (ascending). The output will be also as shown in the above image.
Step-3: Select column "chase" in the table and click Fill>>Down option.
Step-4: Repeat step 3 for column"target" as well.
The final output should be as below. Just move back to main report by clicking "Close and Apply". Data should be now as expected in your report.
When you display the forecast, put it in a grid and add the project column, the week column (e.g. Week 1) and the forecast measure. When you select your multiple projects the grid will show each of those along with the calculated measure. If this does not work, there is something wrong with your measure and you should add your measure calculation script to your question.
The measure should be simple, something like:
Forecast = SUM(YourTable[Chase]) * AVERAGE(YourTable[Target%])

Change Slicer Value in dropdown monthly to quarterly in power BI

I have a Power BI report in which i want users to select "Period Type" in drop down. and when they chose values like Monthly or quarterly it should dynamically change the slicer values to monthly or quarterly.
example is given below.
When Period Type Is Selected To Montlhy
https://pasteboard.co/IYuYSO2.png
When Period Type Is Selected To Quarterly
https://pasteboard.co/IYuYcVw.png
And i have data set with DimDate Table and FactSales Table. Both are joined Table with One to Many relationship.
Your question looks tailor made for a visual from the marketplace. Check the following link out:
https://appsource.microsoft.com/en-us/product/power-bi-visuals/WA104380786?tab=Overview
This slicer will let you choose the frequency and then your slicer will change to reflect that. You can download this from the marketplace. If you have not done this before, you can do this by selecting "Import from marketplace" option after clicking on the 3 dots at the end of the Visualization tab. Hope this helps.

PowerBI - Cumulative diagram with changing values

I am attempting to create a cumulative graph much like this one:
I have the following table in PowerBI
BugHistory
BugID
Date (date)
DateTo (date)
EntityStateName (text)
Effort (number)
I would like to do a measure that would tell me the amount of summed Effort on any given date for each EntityState.
I have tried quite a few things, even adding a Date Table using the Calendar, but getting the values to be shown correctly on a StackedGraph seems to be beyond me.
Hope someone can help.
Follow the following steps:
Right click on the column "Effort" and click the option called "New quick measure" in the right click menu.
In the window that appears, choose "Running Total" under the Calculation drop-down
This will show 3 new fields
In the Base Value field, drag and drop the "Effort" column
In the Field column drag and drop the "Date" column.
In the direction column choose Ascending
This will create a new measure in your Table. You can use that measure in you chart.
You can refer to the following video for reference: https://youtu.be/KlXclbN4oWE?t=497