DAX comparison operations do not support comparing values of type True/False with values of type Integer - dax

Hi I am looking to complete a vlookup to determine rate costs. I have created a date calendar that contains bank holidays and created a relationship with my main data set. if a job was completed on a sunday or a bank holiday it would be rate 3 or if it mon-fri after 6pm and anytime saturday then rate 2 and all others rate 1. I have tried completing a vlookup howerver it show an error "DAX comparison operations do not support comparing values of type True/False with values of type Integer". i am only learning power BI and any help would be greatly appreciated.
I have columns that show start day, start hour and true/false if it is a bank holiday (Cant seem to add picture)

Related

PowerBI - Displaying the average of row figures in a matrix

I've been Googling around this problem for hours and haven't found a solution that suits my needs.
I have a large data set with agent activities and the total time in seconds each activity lasts. I'm pulling this together in a matrix, to display agent names on the left and the start date of each week across the top like so:
This is working as intended (I've used a measure to convert the seconds into hours) but I need the average of the displayed weeks as another column, or to replace the Total column.
I've tried solutions involving DAX measures but none are applicable, likely because I'm using a custom column (WeekStart) to roll up my numbers into weeks. Adding more complexity is I have 2 filters on the matrix; one to exclude any weeks older that 5 weeks in the past and another to exclude any future weeks.
In Excel I'd just add another column next to the table, averaging the 5 cells to the left of it. I could add it to the data table with a SUMIFS checking the Activity date is within the week range and dividing the result by 5. I can't do either of these in PowerBI and I'm new to the software so I'm at a loss as to how to do this.

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:

DAX formula, crossfilter function nor returning expected result

I'm obtaining wrong results from a DAX formula and I can't understand why.
In my database I have articles that are composed by multiple tools, which are produced from blank tools. One blank can be used to produce multiple tools. I need to calculate blank sales by 3 time periods: last 6, last 12 and last 24 months.
This is my Power BI model:
The time period table I used for the time period slicer and the measure look like this :
To obtain Blank's sales volumes, I created 3 measures:
When I use the last formula, which I thought would have returned the right amount of Blank sold by article by time period, I obtain strange results.
When I select "last 24 months" time period, everything looks fine:
When I select "Last 12 months", the total is fine, but the total by article is wrong:
Finally, if I select "Last 6 months" time period, all the results are totally wrong:
The curious fact is that I checked the result by executing a sql query on the database, and the DAX formula returns the right result (so 1466 for the selected time period), but only when used in a card, without filtering it by Article number.
I have no other filters that affect the visuals.
Could you help me understand why I'm not obtaining the right result, or suggest a better way to reach the desired results?
I'm guessing (at least part of) the problem is that you are backing up from different end dates because LASTDATE(Sales[DocumentDate]) can return different values for different ArticleNo.
I'm not sure what value you actually want for that date, possibly LASTDATE('Dates Table'[Date]), but I'm pretty sure you want it consistent across different ArticleNo.

How to calculate month and any additional days between two dates using google sheet formula?

I want to calculate month between two date and output how month and any additional days by using google sheet
I use this formula to calculate month but i don't know how to calculate any additional days after a complete month.
DATEDIF(AG2,TODAY(),"M")
Quoting this reference of DATEDIF (emphasis mine): https://sheetshelp.com/datedif/
Syntax
=DATEDIF(start_date,end_date,unit)
start_date Date at which to start the calculation
end_date Date at which to end the calculation
unit Type of output. Choices are “Y”, “M”, “D”, “YM”, “YD”, or “MD”.
...
"M" – Number of whole months elapsed between start and end dates
"MD" – Number of days elapsed after the number of months shown with the “M” or “YM” unit. Can’t go higher than 30.
...

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