Creating a Quick Calculation with Dates that Repeat in PowerBI - powerbi

So, I'm in PowerBI Desktop. I have a table that pulls in data for various properties (website A, website B, website C) and creates a row for each property, for each day. So, for example, it'd look like this over the course of three days.
A snapshot of the data:
I need to create a single measure, showing the total number of returning users (for all properties) month-to-date.
My original plan was to do Quick Measures > Time Intelligence > Month-to-date Total.
The "Quick Measure" form I'm using:
This creates this measure:
usersReturning MTD =
IF(
ISFILTERED('dailyLog'[date]),
TOTALMTD(SUM('dailyLog'[usersReturning]), 'dailyLog'[date].[Date])
)
However, when I try to make this value shown in a card tile, it just shows (blank). And in the past, I know at some point it creates another kind of error. (I'm having difficulty replicating the value.) I'm wondering if this is because I don't have unique dates, but repeating dates? But I'm not getting any feedback on why.
I'm relatively new to PowerBI, and particularly to the quick measures and DAX scripting. So open to help or suggestions, and wondering if there is a way to make this work with the data schema that I'm showing here.

Based on this data...
You can use a TABLE visualization. Don't check date, & use sum on the returning users to get this report:
Your "single measure" is 7565, but you can also see a summary of A, B, & C to understand how that measure came to be. But if you really just want the 7565 all by itself, then select Card as the visual:

Related

Power BI DAX - Measure to change name of row value

I need some help creating a measure to change the name of "FROM_USER" in the slicer here.
I think I need to use the function SELECTEDVALUE, but I have not managed to get it working.
So, the column has only two values, CRAWLER and FROM_USER.
Any suggestions would be helpful!
See picture
Measures can't be used as slicer values. If you want the column values to be changed and yet to be used in a slicer, you need to create a calculate column to change that.
Column = IF('Table'[Column1]="FROM_USER","desiredValue","CRAWLER")
If you are really keen on using a measure to slice, you need to build a disconnected table and follow the method described here. But the performance will take a hit depending on how complex your data model and calculations are.

Power BI Table w/ Slicer Where Other Columns Adjust Parameters Based Off Selection

I have the following Power BI table example for an operating expense report that uses a slicer to filter the first column named "Actual". This is to see the operating expenses for one month compared to the budget figures for the year. It also compares the year-to-date and annual figures. How can I create dynamic columns that change based on the slicer selection? These additional columns are not shown in the pic below but included in the last pic. The Budget column below was just created as an example to show what it should look like.
I set up a star schema with several tables shown below. There's only one expense fact table used and the slicer only works for the first column as previously stated but I need all the other columns to use different parameters and adjust based off what's selected in the slicer. The last image is an overview of the info and the parameters for each column. I tried creating new columns with measures for the budget to see if I can get that going but can't figure out how to make it adjust with the slicer selection.
I'm not sure if I should be using separate queries for each column or can this be done using the one expense table. Hope this isn't too confusing. Please let me know if more info is needed.
If I understood what you wanted correctly I think I solved your problem.
I was able to create the following:
I did not use all values since I did not want to type everything, if you provide some test data it is easier to replicate you dashboard.
This matrix (so not table) allows you to filter for Date (if you so desire, you can always show all date's in the matrix) Book and AccountTree.
The way this is done is by putting the address column in the ROWS for the matrix, Putting the Date column in the COLUMNS of the matrix and putting your values (actual, budget, variance) in the values of the matrix.
For the date is used days, since it was easier to type. You can always use weeks, months, quarters or years.
For this to work you have to create the following relationships:
Hope this helps.
If not, please provide test data so it is easier to try and solve your problem.

Creating a measure using DAX function Left on a table from Azure Analysis service

I am trying to get the first 4 digits from a string from a table in Power BI. The connection is a live connection / Direct which does not allow me to edit the query. Also, I am unable to create a new column. So I have to stick with creating a new Measure.
Now, I am using the following formula to get what I need.
LocationCd = mid(vw_DW_Contracts[ContractNumber],1,5)
but, this is not working a the vw_DW_Contracts table cannot be used in a measure. Is there a workaround to such problem?
I do not have access to the analysis service so cannot make any modifications in the source.
Please help.
Thanks
but, this is not working a the vw_DW_Contracts table cannot be used in a measure.
I'm not sure what you mean by this, but I'm guessing the message you see is telling you that measures expect an aggregation. The formula you posted would be great as a calculated column where it can be evaluated row by row. Measures are aggregations over multiple rows.
If you are trying to make a new field that is the location code that can be used in visuals on a categorical axis, this should be a column rather than a measure. You could write a measure to show a location cd using something like LASTNONBLANK (mid(vw_DW_Contracts[ContractNumber],1,5), 1) but I doubt that is what you want.

Including Re-occurring Time Saved in Date Slicer Output

I am looking into utilising PowerBI to identify time saved due to various Projects. People will add the projects to a Sharepoint List which then feeds into PowerBI.
PROJECTs Table:
Project Tite, Desc, Hours/Month Saved, StartDate, EndDate, Repeat? (T/F)
[Some Projects only save a fixed 10 or so hours, others save time per month (indicated by the Repeat Column)]
I've created two measures, RUNTIME determining how long the project has run in months ((TodayDate - StartDate)/30) as well as TIMESAVED which is the total hours saved from that specific project (RUNTIME*Hours/Month Saved).
Whilst this works, it has a pretty big limitation. When selecting a range, say 01/01/2017 - 01/01/2018, any projects with a start date before that range are excluded. However these maybe on-going, meaning the time saved by this project during the range needs to be added.
I've attempted to find a solution to this, however I keep getting stuck at requiring the the filter dates from the slicer, however I'm not certain this is possible. I need those projects with on-going savings to have the savings during the period given to be counted as well.
Possible alternative maybe to create a Month/Year column per Month/Year with a custom formula per column to determine that projects Hours saved for that Month/Year however this seems inefficient, at that point back to Excel might be better.
Any ideas / suggestions would be greatly appreciated, currently running through any ideas to solve but keeps coming back to needing that value specified by the filter. Cheers in advance for any advice tackling this :)
See also: https://community.powerbi.com/t5/Desktop/Re-occuring-Savings-over-Time-with-Time-Date-Slicer/m-p/346100
Unfortunately, there is no current simple solution to this problem out-of-the-box with Power Bi. All of the slicers seem to handle dates as a single point in time. They suffer in that if you are dealing with any items that span a Start and End date (like your projects, and most of my data examples) they only take one of the dates as the input. The slicers need to accept an optional end date in our case and then perform a simple date span overlap logic to determine the items that match.
I tried to solve your problem with out-of-the-box Power Bi Desktop slicers and a custom visual Timeline Slicer I found at the store with no luck earlier this month. Out of frustration, I posted a question in the Power Bi forums for suggestions.
The final suggestion from the forums I got was to "use two Filters at Filter pane". But I am not satisfied with this answer.
The Timeline Slicer code is open source and when I get more time (ha ha), I would like to make this change to the Timeline Slicer and publish it back to the repository for everyone to use.
I will monitor this question and the forum to see if a solution emerges in the future.
You can use Timeline Storyteller. you can create your time line and add a couple Slicers for Start and End. It will split by day the dates and you won't miss any data.

How to compare two columns values in the same table PowerBI DAX

I am working in a data analysis project using MS Power BI, thankfully I'm doing good work to start. However, I'm facing a little problem with DAX syntax. I come from a web development background. Anyways, my current problem is that I have rental vehicles, which can be rented from one branch and handed in at another.
I would like to compare two columns values in the same table. 'owner_branch' and 'current_branch'. Is it a good choice to create a filter with DAX? Or should I move to R Language?
If I understood your problem correct you need Calculated Column like this:
CompCol = IF ( Owner_Branch = Current_Branch, TRUE, FALSE )
as a temporary solution which I think that is not an efficient solution for a larger records in future. Anyways, my solution was creating a new column type of boolean.