Cumulative sum & several filters - powerbi

I think I have a simple question, but I'm currently stuck. I uploaded an example file here:
https://ufile.io/7iv97
I want the graph to show a cumulative sum, the thing is: It should calculate from the beginning of the data source until the date on the filter.
The problem is: When my filter does not cover the data since the beginning, the cumulative sum is calculated since the starting date of the filter (I want the cumulative sum to ignore it)
I guess this is simple but I couldnt solve it, so I made a simple example to make it easier to answer my question.
It shows 25 when the filter covers the entire period, but less when I move the filter beyond the starting date:
Thanks in advance!

Related

How do I create an Other category in PowerBI Desktop?

I am learning Power BI Desktop. I have a project already loaded for which I have created a
pie chart.
As you can see, the data is currently divided into two years: 2022 and 2021.
I also have data for previous years that I want to include in the chart. Unfortunately, none of these years has a high number. So I want to group them all into an "Other" category.
I've already tried using the RANKX function as described here (where I copied and pasted the formula from the comment and replaced the field name with my own) and here (where I went through the article step by step using my own field names). I used the exact format shown in both the comment and the article:
Rank = RANKX('Table','Table'[Percent],,DESC,Dense)
(Table is the table name I am using and Percent is the column I am trying to rank.)
When I added the new column to a table, though, PowerBI automatically gave me a sum calculation. This calculation gave me a 1 in each column. When I asked it not to give me a sum, it said it could not display the visual and took me back to the calculation screen.
EDIT: Thanks for your help Kevin! This is the table I tried to draw from. I am an idiot sometimes.
EDIT 2: Now I am trying to use a different field in the formula:
Rank = RANKX('FactClaimActivity','FactClaimActivity'[DirectIncurredLoss_ITD])
(This is the original field that I tried to base Percent on)
My table looks like this. (Yes, I know that 2016, 2017, 2019 and 2020 have negative values and 2014 and 2015 have $0 values. I just want to show what the data is.)
EDIT 3: This time I am also getting an error when I type in the formula, which says "A single value for column 'DirectIncurredLoss_ITD' in table 'FactClaimActivity' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result."
I do not understand why it wants a single result for a formula that ranks the data points based on this field. That seems like it defeats the whole purpose of the formula.
Yet when I use the formula, I get the same result as last time! This column is in the Fixed decimal number format, and it does have many different values.
EDIT: I've found the answer
New Category = IF('FactClaimActivity'[Rank]<=2,'FactClaimActivity'[LossYear],"Other")
The formula will help you get the correct result.

Powerbi Matrix issues with the value field

I have a problem with Powerbi I can't seem to fix. If the answer is obvious i am sorry but i am just starting out with Powerbi.
We are trying to make a dashboard that will show if a coworker is available or not based on a code 1 -3).
We check their availability per ISOWeek. If they don't have work that week they get code 1, when they have work code 2 etc.
These codes show up the right way in SQL but when I want to add them in my matrix table and have the coworker names on the rows, the ISOWeek on the columns and then when i add the Code in values Powerbi wants to show the total, total(distinct), first or last.
The problem is it wont use the code it got per isoweek. Is there a solution for this?
Thanks in advance!
What is should look like in the matrix:
Fixed it by giving the columns: don't Summarize on the modeling tab. Then I gave the code column the minimum value for each week.

DAX function to check the amount of dates that is greater than another set of dates in 2 different columns

I'm currently doing an internship where I have been asked to make a few visuals in Power BI
I've searched around, tried a couple of things. But the truth is I am very much a beginner at coding and functions in general. Only had basic courses of different languages during my education and to be fair, it's a bit outside my scope of work.
So I have 2 columns I need to compare in order to find out how many dates in column 2 that is greater than the dates in column 1
So I'm imagining something like:
Measure = IF[(Investments(Expected closure)]<[(Investments(Actualclosure)]
Basically I want an overview of how many investments have a later closure date than expected.
Next thing would possibly be to create a boxplot showing the distribution (by how far we are off).
I know this is very basic, and possibly not formulated in the best way possible, please let me know if you need any more information.
Thanks in advance
You can use a calculated column as a flag to identify if actual date > expected date and then count the flag.
Flag = IF('Table'[Act] > 'Table'[Exp], 1, 0)
Hope this helps. Thanks.
enter image description here
Welcome to the community. Be sure to read to read this for posting questions.
For your questions, you can use the following code. You are filter the table with your logical expression with FILTER and then you count the lines of a column with COUNTA.
Measure = CALCULATE(COUNTA('Investments'[Actualclosure]),FILTER(ALL('Investments'),'Investments'[Actualclosure]>'Investments'[Expected closure]))
Hope this solves your problem.

Running Total By Date in Visualization

I'm trying to create a line chart visualization that shows a constantly increasing sum over time. I think this would be called a cumulative total or a running total, but most of the questions I've seen on here have been about showing a total at the bottom of a matrix, subtotals, etc. Instead, I just want to visualize the units from the previous date being added to the current date, and so on. Not sure if this would be a custom column in the dataset or if there is an existing function for this.
Any help is appreciated. Thanks!
Goto Quick Measures, in the "Calculation" dropdown, select "Totals - Running Total", pull in Base Value (what you want to aggregate) and Field (probably your calender) and here you are!

How to build a matrix, similar to the table from Google analytics

In PowerBI I'd like to build Non-standard matrix very similar to the report in Google Analytics.
What do I have now:
I want to change my subtotal to measure, which is calculated as the difference in percentage of the two values
What I want to get:
In Power BI, there is no way to override the subtotals of a matrix with a calculation. Part of the challenge is that you know there are only two date ranges, but as far as Power BI is concerned, there could be any number of date ranges.
It's difficult to tell from your question exactly what input you have and what output you're looking for. Further, the numbers in your screenshots are obscured. However, one consideration would be to solve the problem using measures (i.e. a measure representing the first date range, a measure representing the 2nd date range, and then a measure calculating the difference between them). You may need to change the layout of your visual a little to make this work and the specific design would depend on how static your date ranges are.