I have data of few years of submitted and unsubmitted application, which I am showing in an area chart. I want to add filters like "daily"(it should show today's submitted & unsubmitted), "weekly"
( it should show the current week data), "monthly" (it should show the current month data )
My data format:
Please help me with those three measures, which I can use as a filter. I have already done the Dynamically Add or Remove Measures to a slicer.
Following I want to achieve, Internally those three options "daily", "weekly" and "monthly" I have linked with three dummy Measures. Or else you can suggest any other approach.
Currently, I got a suggestion from powerbi community,
to use to measure for the submitted & unsubmitted, which DAX formular & link I am sharing below, Now the graph is changing as per the option clicked but the values it is sowing is wrong.
Measure :
Submitted Sum =
var Daily_Sum= CALCULATE(SUM(Applicant_data[Submitted]),ALLEXCEPT(Applicant_data, Applicant_data[Postion Type ],Applicant_data[Date]))
var Weekly_Sum=CALCULATE(SUM(Applicant_data[Submitted]),FILTER(ALLSELECTED(Applicant_data), YEAR(Applicant_data[Date]) =YEAR(MAX(Applicant_data[Date]))&&WEEKNUM(Applicant_data[Date]) =WEEKNUM(MAX(Applicant_data[Date]))))
Var Monthly_Sum= CALCULATE(SUM(Applicant_data[Submitted]),FILTER(ALLSELECTED(Applicant_data), YEAR(Applicant_data[Date]) =YEAR(MAX(Applicant_data[Date]))&&MONTH(Applicant_data[Date]) =MONTH(MAX(Applicant_data[Date]))))
return
IF(ISFILTERED('_Measure'[Selection]),
SWITCH(SELECTEDVALUE('_Measure'[Selection]),
"Daily", Daily_Sum,
"Weekly", Weekly_Sum,
"Monthly", Monthly_Sum
),
BLANK()
)
https://community.powerbi.com/t5/Desktop/Measure-to-show-the-data-as-daily-weekly-monthly-in-power-bi/m-p/1039068#M488207
There are 2 common ways to make this work :
Way-1 : Utilizing Power Query
Create a "Date Table" using the date column in power query
Add 3 calculated columns that extracts month, week and day info from the "Date" column in the newly created "Date Table".
Now, unpivot the "month", "day" and "year" columns and load the file.
Create a one to many relationship with "Date" columns as common in both tables and there you go.
Way-2 (Using Drill-through buttons).
Use the recent feature update of Power BI, i.e., drilling the data using buttons. So, you just need to create a date hierarchy and then drill through using buttons for "month", "week"and "day".
I hope this will help you.
If you still got the doubt then please send me the dataset and I will give you an detailed explanation on this.
Related
I am learning PowerBI as i go along and have been able to solve most issues faced by a quick google. Unfortunately this problem has baffled me.
We have thousands of lines of data which include a "Home Country" column & "Away Country" column.
What we need our slicer to do is to is to pick up for example Australia in both of these columns and display the results.
I currently have a table created using the below:
slicercountrytable = distinct(
Union(
Values('All Data'[Home Country]),
Values('All Data'[Away Country])))'''
and then a measure:
Measure =
if(
Min('All Data'[Home Country]) in values (slicercountrytable[Country])
|| Min('All Data'[Away Country]) in values (slicercountrytable[Country]),
1,
Blank()
)
And have also tried the below measure:
Measure 3 = VAR
Searchvalue=search(SELECTEDVALUE(slicercountrytable[Country]),SELECTEDVALUE('All Data'[Combined Country]),,Blank())
Return
If(Searchvalue > 0,"Found")
I need the slicer to control the entire sheet however the above are doing nothing.
Thanks
In that case, instead of building some complicated DAX I suggest to work the model.
Let's say your current table looks like that:
id
home country
away country
1
A
B
2
B
C
You may want to deal with that in another table by unpivoting home_country and away_country in PowerQuery.
In order to have a country table like that:
id
country
attribute
1
A
home
1
B
away
2
B
home
2
C
away
Then you link this new table to your existing one on id and filter/slice in it.
I reproduced your example and feel that it is already showing the desired behavior. I think the problem you might be running into is that you will now need to add your 'measure' filter to each and every visual individually. It cannot be added to 'Page' or 'All Pages' filter areas. This is because of the way a measure's calculation varies across context and cannot be avoided.
DAX
Table 2 = distinct(union(all('Table'[Away]), all('Table'[Home])))
Measure =
if(
MAX('Table'[Away]) in VALUES('Table 2'[SelectedCountries])
|| MAX('Table'[Home]) in VALUES('Table 2'[SelectedCountries]) ,
1,
blank()
)
I am building a report in Power BI Desktop, created a slicer - YearMonthSort - which has data selection by Year-Month
Plz, see the screenshot below:
My goal is to limit data in this slicer as -
2015-07 to today's date
(whichever it will be when users will look at the data,
in the same format - "YYYY-MM")
In the "Filters" section I can select my starting year as 2015-07,
but having problem setting today's date.
I tried to create the new Measure, but not sure where to place it,
or, may be there is another way to perform this:
IsToday = FORMAT(TODAY(), "mm/yyyy")
I only just started to learn this,
Thank you for help in advance!
You can do the following:
I am assuming that you are using a calendar table that is joined to your fact table on a date field and that your year sort column is calculated with reference to the 'date' field in your calendar table.
Assuming, this is true you can create a calculated column that will flag whether or not the date field is before or after today. This can be achieved by using the following DAX:
IsToday =
SWITCH (
TRUE (),
'Calendar'[Date]
<= NOW (), 1,
0
)
Then, in your visual add a 'Visual Level Filter' using this new column and set it to 1.
I'm not sure I've summarised this question correctly, so I'll add a description below of the actual problem.
We have a report that displays data for 'jobs'. These jobs have a few relevant date fields on them such as Created Date, Completed Date and Invoice Date. We currently have 3 slicers on the report that work as expected based on these dates.
Users sometimes use all 3 slicers at the same time and end up with all sorts of useless data. No matter how many times we've told them to reset the filters before changing the date slicers, they keep forgetting to do that.
They also do not want to have 3 separate reports.
We've been tasked with providing them with the following:
Something that lets them select what they want to filter on, with the options only being Created, Completed or Invoiced
A slicer that works based on the option they selected above.
We've tried creating a calculated column that is set to one of those dates based on the option selected in the disconnected slicer, and then adding a slicer that works off that column, but we aren't having any luck. The values in the calculated column are not correct
This is what we've done in attempting to solve the problem:
Create a measure that captures the selected value
SelectedMeasure = SELECTEDVALUE('Date Filter Options'[Name],"Created Date")
Create a calculated column to set the appropriate date value
Please note we're only testing with two out of the three possible values at the moment.
Selected Date Filter = if(jobs[SelectedMeasure] = "Created Date", (jobs[Created Date (DateOnly)]), (jobs[Completed Date (DateOnly)]))
What we're finding is that the Selected Date Filter column does not update with the correct date value, even after we change the slicer and the measure updates as expected.
We're totally stumped - I'm aware we are probably a fair bit away from the correct solution, so any help would be appreciated
Not quite sure how to best present the data model, but here are the relevant fields of the 'jobs' table
jobNumber: string
jobId: guid
CreatedDate: date
CompletedDate: date
InvoicedDate date
The Date Filter Options table just consists of one column with these options:
"Created Date"
"Completed Date"
"Invoiced Date"
I have data from multiple countries on a monthly basis. Since the updates are not regular, I want to set up filter to visuals, so they would show the last month for which I have data from all the countries. I have data from each country loaded into a separate dataset, which then are merged into one big. Is there an easy way to place such filter? I managed to use "LASTDATE" function in each of country sets to find which date is last, but if I try to filter with that measure, I simply get nothing in a result. Thanks!
Well, this feels a little clunky to me but I believe it will work for you. There are two steps. The first is to create a summary table that reads through your data and counts the number of distinct countries that you have in each month. This will be a new table in your model, so go into the modeling tab, click 'New Table' and add this DAX. Obviously, correct for your table and column names.
SUMMARIZED_ROWS = SUMMARIZE(
'Table1'
,Table1[Month]
,"CountOfCountries"
,DISTINCTCOUNT(Table1[Country])
)
Now add a measure to the table (or anywhere) like this:
MonthWithMostCountries = CALCULATE(
LASTNONBLANK(SUMMARIZED_ROWS[Month], 1 )
, FILTER(SUMMARIZED_ROWS, SUMMARIZED_ROWS[CountOfCountries] = MAX(SUMMARIZED_ROWS[CountOfCountries]) ) )
This is going to give you the month where you have the most distinct countries in your data. You'll want to look at it in a card or similarly isolated visual as it is a measure and can be affected by filter context.
So, on the left is my mock data - 3 countries, 3 months each with a 1 month stagger. On the right you see the result of the Summarize table. Then the measure showing the final result.
Hope it helps.
I am trying to create a report and i have a table of data which is having project name,pro id,emp name,id, location(off/onsite) like all are basic info about the each employee.
I am using RLS so that when ever a person can login to this report he can view their own personal data.
When i login to this report, then i can able to see the project id's which are having under my list.
Now i am trying to show the basic emp details in a table like as emp name, id, role and location.
But in table i can see the only value of the person who login to the report.
I cant see the rest of employees which are belong to the same project id and their info in table.
I have tried a dax using calculated table funtion as below for only single pro id by using NEW TABLE option.
Table =
CALCULATETABLE(
SUMMARIZE('Basic Info','Basic Info'[Employee ID],'Basic Info'[Employee Role],'Basic Info'[Employee Name]),
FILTER('Basic Info','Basic Info'[Project ID]="C.0010978"
))
And it is giving the output for that perticular project.
But if i remove that hard coded pro id and put column of the pro id from table as
Table =
CALCULATETABLE(
SUMMARIZE('Basic Info','Basic Info'[Employee ID],'Basic Info'[Employee Role],'Basic Info'[Employee Name]),
FILTER('Basic Info','Basic Info'[Project ID]='Basic Info'[Project ID]
))
then it is not filtering the values as the projects filtered from the slicer as show in above image.
It is showing all the emp names and their data.
Any suggestions.
Thanks in advance,
Mohan V.
You cannot use slicer values in a calculated column. Calculated columns are evaluated during the data load and are not responsive to any visuals, filters, or slicers.
You may want to try using a measure instead of a calculated column.
Try searching the web for "power bi column vs measure" for more info on how each one is used.