How do I Filter a Measure in a Graph in Power Bi based on a date - filter

i have a bar Chart in Power Bi , where i want filter a certain Measure based on a Date.
It only should shown for every month who is not after than a certian date.
In my example its the end of June
i tried with Measures but it gives too much before.
Total Sales Filtered = CALCULATE([Total Sales],FILTER('Date','Date'[Date]<MAX(ClosedMonthsDates[Date])))
Where is my Mistake?

Nevermind, i figured out i just forget the equal ^^
Total Sales Filtered = CALCULATE([Total Sales],FILTER('Date','Date'[Date]<=MAX(ClosedMonthsDates[Date])))

Related

Row wise total and % base on selection date

I did measure column but total is incorrect.
LINE_Total = sumx(Report,Report[COMP_LINE]+Report[POSTED_LINE]+Report[REJECT_LINE]+Report[SUBMIT_LINE]+Report[WAPPR_LINE])
I understand- it is showing total and not considering selection date criteria. Please help me to include selection date criteria
System is not allowing me to include picture as example.
Thanks

Tableau - Fixed calculated field depending on date filter

I'm new to Tableau. I am trying to make an inventory report which tells the user how much of certain product he/she should buy in advance.
Depending on the amount of days selected on the filter, the difference in days of the complete period should be calculated. For example: If the filtered dates are from 1/03/2021 to 09/03/2021, the result should be equal to 9. The formula I used is the following: date_difference = DATEDIFF("day",MIN(DATE([Fecha])), MAX(DATE([Fecha]))) + 1
The problem comes when I try to use the value given by such date filter. My next calculation should be:
calc = Quantity Inventory / (Units sold / date_difference). Both Quantity Inventory and Units sold are calculated fields in which I have no problem. However, instead of having a fixed value of 9, date_difference changes as shown in the image, giving me incorrect results for the desired calculation.
How can I make sure that the calculated field date_difference has the value of 9 on all rows?. Actually, if I add date_difference field by itself in a different Page it does show the proper value. The problem occurs when calculating calc and trying to add it to the table.
Note: Remember that the value of date_difference will change, depending on the range of time selected on the date filter
Thanks a lot in advance.
Step-1 Use this calculation for date_difference instead
DATEDIFF('day', {min(DATE([Fecha]))}, {max(DATE([Fecha]))}) +1
Step-2 Add Fecha filter to context, by right clicking it in filters shelf.
This will solve your problem. See the GIF

Power BI - Calculate Difference between previous day volume and the next day volume

I have got a table that only contains two column Legend (for Dates) and EOD Volume (for volume) as shown below.
I need to calculate the difference between the previous date volume. For example to calculate the difference between Feb 29 to March 2nd, it will be ((1469-1877) / 1469) * 100%. How to do create this measure in power BI. And the data also contains weekends and weekdays and i will need the analysis for all dates regardless of weekends and/or weekdays. Could someone please help me on this. Thank you in advance.
My propose solution works in a table at day granularity. Additionally, to handle working day the best-practice is to manage it as a binary attribute in the back-end because working days differ country by country so there is no standard dynamic way to handle them.
Possible Solution:=
VAR _YESTERDAY = CALCULATE(MAX('Fact'[EOD Volume]), PREVIOUSDAY('Calendar'[CalendarKey]))
VAR _TODAY = CALCULATE(MAX('Fact'[EOD Volume]))
RETURN
DIVIDE(_TODAY - _YESTERDAY, ABS(_YESTERDAY))

Rank only for latest month

I've a calculated field "Total Revenue" which blends revenue from multiple data sources in Tableau.
Based on this field (aggregate field) on monthly basis, I would like to show only TOP 5 items with highest revenue as of latest month.
As shown in above table, items have to be filtered out (as they are TOP 5 in March) based on revenue data as of the latest month (March). How can this be achieved using RANK()? I'm not able to rank only for latest month as formulated below because it shows error as I cannot mix aggregate and non-aggregate functions.
IF DATETRUNC('month'),ReportDate)=//March 1st date given//
THEN RANK(Total Revenue)
END
My solution is a kind of workaround but seems to be working:
Create a calculated field with below formula:
IF DATEPART('month', {MAX([date])}) = DATEPART('month', [date])
and DATEPART('year', {MAX([date])}) = DATEPART('year', [date])
THEN
[revenue]
ELSE
0
END
The {MAX([date])} part on the code gets the maximum date in your data, it is fixed with { and } characters so that the value is not effected by the filters, date partitions etc. If you want the sorting month to be the one we are in then you should change that part with NOW()
Now we have a value containing only the sum of the latest month and we can sort our visual with this Measure.
You can drag your new measure (I called my measure: 'last month revenue') to the details and right click your item pill on the Rows, sort it by your new field.
And finally drag your item to the filters and go to Top tab, make filter your data according to sum of "last month revenue" measure.
Below screenshot shows the excel data and the final Tableau table:

Comparing data in kibana

I am indexing user data for each day and using Kibana to analyse it, so far I am able to visualize all my requirement. But I am not able to visualize following use case
I want to analyse total number of user,repeated number of users from previous day and how many are unique.
I can visualize total number of user for day , but how do I compare today's data from yesterday.
Any help appreciated.
Thanks in advance
I hope I understand your requirement correctly, but you could create a Vertical Bar Chart visualization with Kibana and change the default 'Count' to 'Unique Count', select the field you like to do the unique count for and then add an X-Axis with a date histogram on your timestamp field.
This will create a bar chart and each bar will contain the unique count for each time interval. So if you select 7 days as your timeframe and 1 day interval in your X-Axis date histogram, you'll see the unique count per day.

Resources