I have this sample table:
"Running Total" is a MEASURE (NOT a column), and I need to change this measure such that it works when the date column is filtered.
Current code for "Running Total", which generates the above output:
Issue with the code: It does not work when the "date" column is filtered using a slicer.
I need this output when the date filter is set to 2018-01-01-2023-01-01 for example:
As you can see, 2017 dates are removed, therefore the "Running Total" measure is adjusted accordingly.
How to achieve this?
Replace ALL() with ALLSELECTED()
Related
I have a table (we'll just call it MyTable) in PowerBI that includes a Date column. I have created a DateDimension table using CALENDARAUTO() with columns for the Date, Month#, MonthName, etc and created the relationship between that Date and the Date in MyTable.
I want to calculate the average year based on the records in MyTable. For example, if I have records with 1/1/2005, 1/1/2014, and 1/1/2015, the average year should be 2011.
How would I go about doing that? I've tried doing a measure of AVERAGE(DateDimension[Year]) and adding that to a Card visual, but it just shows 2.01K. If I do FORMAT(AVERAGE(DateDimension[Year]), "####"), the average is completely wrong.
Since you already have this DateDimension table, use
Average =
AVERAGEX(
MyTable,
RELATED(DateDimension[Year])
)
You can control the formatting by clicking on the measure (Average) and then using the Measure tools pane:
Set it to Whole number and no thousands operator.
I have a table and a What if Parameter Slicer as shown in the image below,
What I want to do is make the Slicer interact with the Table, that is, if the Slicer value is greater than any of the Total Sales value of any customer, then that customer should be filtered out from the table.
How do I make sure of this?
I tried to add a Visual Filter on the Total Sales Column and tried to do this, Filter out all the values where Total Sales < Slicer Value, but it also didn't work for me. As it doesn't allow me to add "Slicer Value" attribute in the Visual Filter.
You can download the related Workbook from here: https://drive.google.com/file/d/15x7m3nXdlRgHdPBxOGqrJRVYYX8hEgLp/view?usp=sharing
Why I am doing this using a What-If Parameter and not by simply adding Sales Column as Slicer, is because I want to use the value of this slicer to create additional measures. That is something I can't do with Sales Column
I have a solution for you! Instead of using column , You need to create a measure first using this DAX Code:
Total Sales = CALCULATE(
SUM(transactions[sales_amount]),
transactions[sales_amount] >= SELECTEDVALUE('Sales Amount Filter'[Sales Amount Filter]))
Then If we test it on the same visual:
I hope This is what you want to have in the end!
I have a date slicer that is controlled by the user. I am trying to use the users min/max date selection as a indicator. I have created two measures - one for the min value and another measure for the max value. Please see DAX code for one below:
NewMin = CALCULATE(FIRSTDATE('Master Query'[RegisterDate]),ALLSELECTED('Master Query'))
Now, on the Master Query Table there is a column that holds date values in the format of dd/mm/yyyy 00:00:00...I am adding another column and using a if statement to get a 0/1 output (i.e. checking if the date column is between the min and max date slicer selection) but it is not working. See DAX Below:
RangeCheck = IF('Master Query'[RegisterDate] >= 'Master Query'[NewMin] && 'Master Query'[RegisterDate] <= 'Master Query'[NewMax],1,0)
This does not work and I am unsure as to why. It seems its not recognising the dates or cant decipher if date is between the two min and max boundries.
A calculated column cannot read in dynamic filters from slicers. Calculated columns are only computed once per time the model is refreshed, not in response to interaction slicers or the filter pane.
In contrast, measures do work for dynamic calculations (though not when you try to use them within a calculated column).
I'm learning DAX and I'm trying to make a measure for Sales Last year.
this formula works :
Sales LY = CALCULATE([Sales CY],SAMEPERIODLASTYEAR(Date[Date]))
But when I add FILTER to the measure, it gives me the values from the current year like "Sales CY"
Sales LY = `CALCULATE([Sales CY], Filter (dim_date, SAMEPERIODLASTYEAR (Date[Date]) ))`
I already have a date filter on the page relative date in this year
the invoices Table and Date table are joined on the date of the creation of the invoice (createdat)
Any ideas what's the meaning behind the things in blue circles?
The FILTER function expects a condition that can be checked for each row of the table instead of a column of dates returned by SAMEPERIODLASTYEAR, so I wouldn't expect the second version to work.
I think the bits circled in blue are emphasizing that you are connected an imported data table to a DirectQuery table (different storage modes).
I've looked all over and can't find a way to do this.
In the table, I have all postcodes throughout the UK and a calculated column that concatenates from another table the products' that have been purchased in that location.
I need to filter the table to hide rows where the value selected in the slicer is in the concatenated column. I think this needs to be a measure and have tried using CONTAINSSTRING but nothing seems to be working.
Latest measure that I have tried is:
=IF(CONTAINSSTRING([Concatenated Values],[Selected Slicer Value]),"Hide","Show")
Does anyone have any ideas?
Example tables and expected results:
You can link the "another table" (the one with the products (not concatenated) per area) to the Area table.
Just change the filter option to: cross-filter direction: both
Then you can use it in your slicer.
Follow these below steps to achieve your requirement.
Let-
Your Slicer Table name: Table1
Your Details table name: Table2
Step-1: Create this following measure in Table2
show_hide_this_row =
FIND(
SELECTEDVALUE(Table1[products]),
MIN(Table2[products]),
,
0
)
Step-2: Add visual level filter using measure "show_hide_this_row" as below-
The output will be as below-
This functionality only works perfect when single selection is enabled in your slicer.