How to do division in this type of datepicker? - daterangepicker

selecting data range values
iam selecting data range values and i want to divided with 7 number how can i do that?
iam selecting 'N' number of dates in date range picker and want to divide with '7'. can anyone give solution.
Thanks in advance.

Related

Sumifs Ratio in PowerPivot

I have a table in Excel, utilizing Power Pivot that I then display/filter using a Pivot Table. Within my dataset, calculating a ratio within Power Pivot that "sums" correctly in the pivot table based on slicers is fine - this utilizes a SUMX(Cost)/SUMX(Total) and everything works fine. By sums correctly, I mean if I further break down the data set based on Region/State/Product/Employee, all those Rows sum up correctly for the ratio percentage.
The dataset is filtered based on a single month or range of months. The result of this works fine for either the single month or range of Months. What I'm trying to do is within my Pivot Table, show a current month ratio AND a year to date ratio. I've tried messing around with equations I've found online, but nothing seems to work. This includes the following attempts:
=CALCULATE([Cost],[ProductID]="224594")/CALCULATE([Total],[ProductID]="224594")
=SUMX (FILTER(ALL('TableName'),PATHCONTAINS ('TableName'[ProductID], EARLIER('TableName'[ProductID]))),'TableName'[Cost]) / SUMX(FILTER(ALL('TableName'),PATHCONTAINS('TableName'[ProductID], EARLIER ('TableName'[ProductID]))),'TableName'[Total])
I need the "sumifs" to sum the cost for Product A for all months divided by the sum of total for Product A for all months. I do not want to hard code in the the Product ID into the equation, but simply sum all previous records for that product, but I can't seem to get this to work.
Any suggestions?
Sample Data Set
I used the calculate and filter functions in a column instead of trying to use them in a measure, which fixed the problem.

Power Bi matrix subtotal is not the sum of the values in the column

I am trying to create a "meetingroom occupancy" matrix in Power BI. The raw data contains bookings per day per Room. The maximum daily available time per room is 12 hours. I have created a Date Dimension Table for the dates.
I have tried to change datatypes, added the available time column in the query editor, added the available time as DAX column and as calculated measure, but all with no success. I have changed the available time for Room B to 1, and the result of the Subtotal was 13, so it looks like subtotals is only summing unique values, but I do not know how to solve this.
Could someone please explain to me what is happening and how I could solve this?
The input data is as follows:
And my Date_Dimension is as follows:
This is the current and desired result:

how to add filter on measure in power BI?

I have Power BI report having some filters implemented on columns. Now I have to add a new filter on the basis of measure, I have data in the following format for that column, +ve integer, -ve integer or 0.
What I'm trying to achieve, there should be a filter with three default values (+ve integers, -ve integers and 0).
When I select +ve, it should show only records having +ve integer values and so on for two other cases.
Problem: I am creating measure from a measure but not getting the exact data from it.
The second thing I did was created a measure of positive and negative, I am getting the exact data if I will use in table visual but not in the slicers form.
Measures are not meant to be used as slicers. A best practice for Power BI is that if you need to filter by a certain criteria then you should create a new column in the data to reflect which values you want to filter by.
If you have a very large data set then I would do this in the Query Editor using a conditional column.
If you size isn't a factor then make a calculated column like so,
Answer =
SWITCH (
TRUE (),
'Table'[Values] > 0, "Postive",
'Table'[Values] < 0, "Negative",
"Zero"
)
Now insert the column into the filter and you should be able to easily switch between what you need.

Knowing in advance which bucket a Hive row will go

When we have a bucketing defined on a certain column, hive calculates hash value for each unique value for the column and sends rows to these buckets. This might lead to skewed buckets, when hash values for multiple unique values cause them going to the same bucket. Now lets say the bucketed column is country, and the values are like:-
country = {'USA','Brazil','Findland','India','England'}
Now there is no guarantee that hashing will send all the 5 countries to different buckets (assume number of buckets are 5). Is there any way to know in advance which bucket a row with specific value for country will be sent to? I am looking for something like this:-
select know_which_bucket(country,5) from table;
It need not be hive function, I am just trying to explain what I am looking for logically, I just need info. Basically i will specify a set of values , number of buckets and want to know which bucket each of the value will go to. If someone can provide Java pointer for this, it will help too. Also, I am not necessarily looking for a programmatic way, even an online calculator will do.
I figured out, this is how you do it:-
For example, to know which bucket(file) 'USA' will go provided that number of buckets are 5:-
select pmod(hash('USA'),5);
It returns 3, so this will be stored in the file 000003_0. This way we can know for any input value and for any number of buckets.

How to get minimum value from range date in DAX

I need to get a calculated measure of the minimum date of a range of values, ie I have a fact table with a date and two measures. When I filter by range date, I need to get the second measure of the minimum date of that range, in the example, the measure 1 of 1st january, something like this:
https://db.tt/6jKBPRCr
The picture on the left is as I have the data in the fact table, data from the right as they should be when I filter from date (from 1st to 6 january). The measure 1 is added for a group, and measure 2 is the minimum value of the range of dates and must be repeated for each resulting record (highlighted).
I need the solution for PowerBI Desktop (DAX)
I would greatly appreciate your help with this.
Thank you for your time

Resources