Sum formula DAX - powerbi

Good evening, I was trying to do some analysis on this dataset.
In the first dashboard I was making a graph but unfortunately it doesn't work on as it should. The histogram should not have equal bars, what did I do wrong?
Is it a problem in the links or do you need a formula in DAX?
Thanks!
(in the file Tot is not a number but also if I change it the problem is the same)
The 2 and the 3 must be similar but they aren't

You have 2 problems.
In your top chart, you're trying to go from INT[Cantiere] to COST[Tot]
Your relationships are uni-directional and therefore do not flow that way.
You are using implicit instead of hand-written, explicit measures. Using explicit measures gives you more control.
I can't advise how to fix as I don't understand your model but this is the crux of the problem.

Related

Summary of column by month with conditions (if greater that one, only one will be considered)

I'm newbie in the PowerBI world and I want to create a matrix for the year of events reported by the users, they are required to enter only one a month however there are some users that create more than one, and only one need to be considered for the report.
I have been trying some DAX functions unsuccessfully.
Thank you in advance for any suggestion to solve my problem.

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.

Power BI: Bar chart with percentage

I need to get a bar chart that displays percentages based on the simple division of 2 values. See below:
The calculation should be 'Services / Sum of Accounts' to get my %. (116,713 / 121,756 = 0.9585 [or 95.9%])
I have tried using Quick Measure, but I can't seem to get it to do what I want. I come from a background of SSRS, but the way PBI works appears to be different enough that I'm not sure how to accomplish this otherwise simple operation. Much thanks!
You probably need to write your own measure. You can start with a quick measure and modify the formula or create one from scratch.
I don't know what your data looks like but it might be something like
SUM(Table[Services]) / SUM(Table[Accounts]).

How to add multiple fields in columns of Power BI matrix and view them without drilldown

I've trying out Power BI to solve some visualization problem in my organization and I've been working on desktop version of Power BI to try out its features.
I'm stuck at few issues and cannot find our way out of this.This is a sample view I've been trying to create:
Figure 1:
1
We've a dataset containing Product Opinion across gender, Age Group, Geography etc. and we want to pivot the opinion across different parameters as shown above.But when we use Matrix view of Power BI and add two parameters in columns, it creates a drill down view as shown below:
Figure 2: 2
On adding multiple fields in the column section we get an option to move down to next hierarchy as shown below:
Figure 3:3
Although we have the option to move down to hierarchy ,we are unable to show then side by side as we've shown in Figure 1.
Is there a way we can get the visualization as given in Figure 1 ?
Also, Currently the columns and rows are automatically sorted alphabetically. Is there a way we can adjust the column and row position as per our needs?
To sort the rows in a custom order, you will have to create an index table. The below link walks you through the steps involved:
http://www.excelnaccess.com/custom-sorting-in-power-bi/
Now, to achieve the visualization you are looking for, the only way I can think of is to create two matrix visualizations (One for gender and other for age group) and place them in such a way, that it gives the illusion of the same table. There might be a better way to do this, but I these workarounds work just fine. Hope this helps.