I currently have an active relationship between two tables. 'All Reports' and 'Activity Log' The field in both tables is called [report_id]. I want to create a second inactive relationship between these tables on the [workspace_report_id]. Here is my dax and my model. There are many relationships to my fact table but no ambiguity. Relationship are inactive if they would cause ambiguity.
Last Date Report Modified =
CALCULATE(
'Activity Log'[Views],
'All Reports',
USERELATIONSHIP('All Reports'[workspace_report_id], 'Activity Log'[workspace_report_id])
)
enter image description here
When i run the dax, it's as if the userelationship function never works. The outcome of the measure is as if the original active relationship is on and the inactive relationship never turns on.
Related
I need to create a kind of dynamic DAX view based on another DAX table.
First Table
Year, Category, Sub-category, Sales, Sub-Category Weight
I need to do a intermediary step different calculation for Sales on another table that looks at the above table however I can't work out how to do do it. I have a slicer populated with a subcategory dimension on the tab so every time I make a change I need the below table to reflect the chosen sub category but without it being in the table.
Second Table
Year, Category, Sub-category, Sales, Category Weight filtered by Sub-Category
I have tried the following functions:
Summarize
SummarizeColumns
CalculateTable
(think there are more)
I have tried to use each with a filter based on the slicer but I can't get it to work.
I have two tables, once for slicer and other one is for details table. The details table have a InvoiceDate column where some rows have blank InvoiceDate. The slicer table looks like below:
The slicer will only show value of of ID 1, like below.
Initially I want slicer to be un checked and the data should show only rows where InvoiceDate is Blank. Once User select the Slicer as Include Invoiced Records, it should show both full details i.e. Rows with Blank + Non-Empty dates rows.
There are two other ways of doing what you want that are probably more 'correct' but I'll also describe a way to provide the behavior you describe.
Option one: Delete your second table. Add a calculated column to your details table as follows:
Invoice Status = IF (ISBLANK([Invoice Date]) = TRUE(), "Not yet invoiced", "Invoiced")
Create a slicer using [Invoice Status] and simply default it to show 'not invoiced.' If users want to see the invoiced records, they just check that box in the slicer as well.
Option Two: Use Bookmarks and buttons to produce the desired effect. Create two buttons, one that says 'Include Invoiced Customers' and another that says 'Hide Invoiced Customers' -- create two bookmarks where one has the invoiced customers filtered out of the visual and one where the invoiced customers aren't filtered. Set each button's "Action" to the appropriate bookmark.
Option Three Keep your 'slicer' table. Let's assume it's called 'Invoice Filter Selection.' Create a new measure:
IncludeDetailFilter =
IF (ISFILTERED('Invoice Filter Selection'[Value]) = True(),
1,
IF (ISBLANK(MAX(InvoiceDetails[Invoice Date])) = TRUE(), 1, 0)
)
When the slicer has a selection, it will be considered 'Filtered' and you will pass into the first branch of the IF where the measure always evaluates to 1. When the slicer isn't selected, the measure will evaluate to 1 or 0 depending on whether or not there are any values for Invoice Date in the row. Add this new measure as a filter on your invoice detail visual.
Unchecked:
Checked:
Hope it Helps.
I am pretty new to Power BI and DAX so I apologize if my vocabulary isn't entirely accurate, however I'm having trouble with the functionality of the program.
Goal: I would like to create a visual that returns the count of ID's based off of date using a date table
Summary of Problem: I create a relationship between a date table and fact table. When creating a visual using the date table field [date], and fact table count of [Id's] the relationship between the date table seems to break and return nothing.
Details: I created a date table and created a relationship to a 'Lead' Database table using the respective "Date" field (in the Main date table) to the "CreatedDate" (in the 'Lead' table). Shown Below
*Uses a 1:Many relationship with a single crossfilter moving towards the 'Lead' table
When I pull in a table in the visualizations, using a the dimensions of 'Main Date Filter'[Date] and count of 'Lead'[Lead Id], it seems theres no relationship between the 'Main Date Filter'[Date] and 'Lead'[CreatedDate] because none of the dates populate and counts all the ID's into a blank date
Also I made sure to turn off filters off for this example and strip all relationships to just the lead object and date
Here are the further data types of each of the fields that are being related
Thank you for taking the time to find a solution and I appreciate the help as this simple problem has been driving me crazy!
Once again the goal is to just return the count of Id's per date and I don't understand why this is not working.
In Power BI I have an inventory with multiple possible owners for each product.
Example data:
Product
Primary Owner
Backup Owner
Widget 1
Frank
Sally
Widget 2
Sally
John
Widget 3
John
Widget 4
Frank
Anna
Desired result: to display the full inventory in a table, and provide a slicer that users can filter the table with. The slicer would be a list of all owners (both primary and backup), and when a user is selected the table would display any row where that user is present (whether they are present in the Primary Owner or Backup Owner field.
With the above example, if you were to filter by John you would see Widget 2 and Widget 3, whereas filtering by Sally would show you Widget 1 and Widget 2.
Failed attempts: Using two distinct slicers does not work for this, as it will hide data in the other column. If John were to filter to himself as Primary Owner, he would then no longer see data for Widget 2 where he is the Secondary Owner. Concatenating the Primary and Secondary together into a joined column also does not work, because I would get items like Frank|Sally or Sally|John and the combined data does not make sense for the user as an option in the Slicer.
Finally I tried creating a separate table that contains the combined list of all Primary and Secondary Owners into a single column, then relating it to the main table, however I cannot have two active relationships at once. I know Measures have access to inactive relationships through Calculate, but I don't know how (or if it is even possible) to create a slicer from that.
Edit: After re-reading your post, it would probably make sense to calculate a new table to handle this. The table will have two columns, Product and Person (or Owner in your case):
Slicer Table =
UNION (
SELECTCOLUMNS (
FILTER( 'Table' , 'Table'[Primary Owner] <> BLANK() ) ,
"Product" , 'Table'[Product] ,
"Person" , 'Table'[Primary Owner]
),
SELECTCOLUMNS (
FILTER ( 'Table' , 'Table'[Backup Owner] <> BLANK() ) ,
"Product" , 'Table'[Product] ,
"Person" , 'Table'[Backup Owner]
)
)
After this has been calculated, create a relationship between these tables, between the Product columns. Since this is purely for filtering the table on the person of interest, make it be Many-to-Many and have Slicer Table filter Table:
Create a slicer with the Person column from the Slicer Table and test the functionality:
My model has got date table, users table. There is a 1:M relation between date and sales. And 1:M relation between date and budget.
Also 1:M relation between user and sales. And 1:M relation between user and budget.
For each year/month/day, I want to calculate the SUMX ( salesamt / budget_alloc )
So I have created a table visual and dragged date into it (from date table). Now made a measure with formula:
SUMX ( sales, DIVIDE(salesamt, SUM ( RELATEDTABLE ( budget[budget_alloc] ) ) ) )
Is this right way to access the budget_alloc value (located in budget table) by measure doing sumx on sales table? There is no direct relation between sales and budget, the relation goes via the date table. I want to check because I have read that table expansion happens towards the 1 side. So looking at the sales table (measure formula) the 1 side is the date table. So will RELATEDTABLE be able to give the measure access to the budget table (and ensuring that budget table respects the date table filter)?