Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreShape the future of the Fabric Community! Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions. Take survey.
Hi all,
I have a question that i think it is not solved in the forum, as many of you i have the necessity to create some visuals/reports with the info in MTD, QTD and YTD. For that and now i'm doing new measures like CALCULATE(sum(sales),DATESYTD(date)) for every calculation and every MTD, QTD and YTD so, for every column i need to do 4 measures (simple actual without filter of dates, mtd, qtd and ytd) and it is not a big problem (only one time in every report) but i need to have one page for each MTD, QTD, YTD and i am asking if it is possible to create any type of slicer that i can filter for MTD, QTD, YTD...
This is an example of my source data:
And the table matrix that i want, something like that (this is an example in excel but the results in BI will be the same)
Now i'm creating one table matrix for each MTD, QTD and YTD with the calculated measures for each table, but i'm looking if it is possible to do something like that:
So, the MTD, QTD and YTD should be an slicer that when I click in MTD the report filters the dates of MTD and then the table shows the the values corresponding to that group of dates.
Could it be possible?
Thanks in advance and regards!
Solved! Go to Solution.
It may be easier if you create 20 measures like the one I wrote yesterday:
Final Value 1 = IF(HASONEFILTER(Table[CalcType]), SWITCH(SELECTEDVALUE(Table[CalcType]), "MTD", [Measure 1 MTD], "QTD", [Measure 1 QTD], "YTD", [Measure 1 YTD] ), BLANK() )
You already have the MTD, QTD and YTD measures, and the 20 you need to create are just copy and paste. Not much work.
Create an unrelated table with the text values "MTD", "QTD" and "YTD".
Add this column to a slicer (Chiclet Slicer would be better)
Then create a measure to select the right value depending on the selected value:
Final Value = IF(HASONEFILTER(Table[CalcType]), SWITCH(SELECTEDVALUE(Table[CalcType]), "MTD", [Measure MTD], "QTD", [Measure QTD], "YTD", [Measure YTD] ), BLANK() )
Thanks for the response,
I can't use this becasue as Fuel, Maintenance (exmaples) i have more colmuns with values so it is not one only column with final value that i can filter using MTD, QTD, YTD formulas. in this case i have 20 columns with values so i have 20columns with actual values (no filters), 20 measures for MTD values, other 20measures for QTD values and other 20 measures for YTD values. So for that reason because there is not only one MEasuire MTD i have 20measures MTD.
I need to create a measure that calculate the days for MTD (using the max value from a slicer). I have tried to create a calculated table
CALENDAR =
VAR BASECALENDAR =
CALENDAR ( DATE ( 2018, 7, 1 ), table[Max date] )
RETURN
GENERATE (
BASECALENDAR,
VAR BASEDATE = [DATE]
VAR YEARDATE = YEAR ( BASEDATE )
VAR MONTHNUMBER = MONTH ( BASEDATE )
RETURN ROW (
"DAY", BASEDATE,
"YEAR", YEARDATE,
"MONTH NUMBER", MONTHNUMBER,
"MONTH", FORMAT ( BASEDATE, "MMMM" ),
"YEAR MONTH", FORMAT ( BASEDATE, "MMM YY" )
)
)
That i could use to create MTD, QTD and YTD creating 3 new columns but the problem in the creation of the calendar is the table[maxdate] in my table i generate every day a row of data for each transporter (bike, car, etc) so for example today i have the row values for yesterday 26th August but in the powerbi the people want to filter until the 23th (exmaple) and then automtically calculated the MTD, QTD and YTD using the enddate 23th August, and the problem in the creation of the calendar is that uses the end date of the calendar the max date source data no the max day filtered in the slider.
I dont know if i'am explaining well my idea, it is very crazy jajajaja
It may be easier if you create 20 measures like the one I wrote yesterday:
Final Value 1 = IF(HASONEFILTER(Table[CalcType]), SWITCH(SELECTEDVALUE(Table[CalcType]), "MTD", [Measure 1 MTD], "QTD", [Measure 1 QTD], "YTD", [Measure 1 YTD] ), BLANK() )
You already have the MTD, QTD and YTD measures, and the 20 you need to create are just copy and paste. Not much work.
@Anonymous
nice solution, what if instead to display a measure a I need to display/hide a existing column in a table ( ex EUR columns vs$ columns) ?
Thank you in advance,
mac
mmmm i dont know the feature to do visibility (hide or not hide) , the only thing is to put or not the measure. So... based on an expresion... i dont know
the only thing that i could remember is if you use bookmarks, you can create the table with the column and other table without the column, and the action when you filter os to move to the bookmarks.. but maybe it is a little bit... hard.
@Anonymous Thanks for your help. Could i ask something of an extension of a similar situation?
Plz have a look at my situation below.
As you can see I have managed to create a measure that can slice the visual based on the selection i make on the Select Index slicer.
Firstly, as you can see from my measure, the alternate result is Blank(), what can i do so that if nothing is selected, all the indexes are selected and the graph shows all the lines together.
Secondly, What i seek to achive further is to create a measure that will slice the x-axis(date) based on the selected value in the select period slicer. Like it should show date range only for 1 month back from today if i select 1 Month and so on.
Thanks in advance
Thanks for the reply @amitchandak :
That's what I want to do, but power bi doesn´t accept it, It won't let me put the column (the highlighted columns in the image)
For power bi that construction is wrong:
this is what I get:
doesn't recognice the column name
This was very useful. However, I need on extra option. Users want to be able to select MTD, QTD, YTD, OR a "range of dates".
Hard to test if the MTD, QTD, YTD are working correctly, since we are in Month 1, QTR 1 of the current year.
How can a I add a "range" option that perhaps opens another slicer with range or allows start/end date entry.
Hi @Anonymous
I did that you are looking for. In the page you need to have 2 slicers: The slicer with the options WTD. MTD, YTD, etc and the other slicer with the dates (start date and end date) and when you create the maasures do something like this
Actual Value TimeFrames = IF(HASONEFILTER(TimeFrame[Interval]), SWITCH(SELECTEDVALUE(TimeFrame[Interval]), "1.WTD", Actual[Value 7D], "2.MTD", Actual[Value MTD], "3.QTD", Actual[Value QTD], "4.YTD", Actual[Value YTD] ), Actual[Value] )
So, if you click in any interval, the system will take the end date and take WTD, MTD, etc... but if you dont select any timeintertal the system will do the calculations for timerange that you select.
That worked. Thanks so much.
Now to test it some more
You are welcome! @Anonymous
oh thanks, I didn't think about that but my problem is solved. Thanks a lot!
Hi @Anonymous
I have done the 20 new measurements with this option and it is was very useful to me but i have found a little problem that maybe you know how to resolve it.
as you know with the functions DAX to QTD values like... CALCULATE(sum(table[cost]),DATESQTD(table[dates])) an using your last reply about the functions to calculate MTD, QTD and YTD when i select it in the slicer..
The problem is when i take a different visual than a Table Matrix, in this case, a line chart with (imagine)
The problem is that in this visual the visual is taking into account all the dates that i have in the source, and i'm looking for a solution that this chart take into account only the dates from MTD, QTD or YTD. I've been thinking:
So i have 2 measures that calculates de date start and date end of my calendar depends of the selection WTD, MTD, QTD and YTD and this is what i've been thinking.
Thanks in advance, regards!!!
solved, It is necesarry to create a measure "filter" with values (YES, NOT) that calculates if the date is between the period of startdate and end date of the interval.
Then insert in the filter visual and filter by "yes"
@dobregon This is exactly I'm looking for in my report. I have the same scenerio of changing Axis (Week,Month,Quarter) and restricting according to Time period selection.
However I do not get you when you say Created measure Filter for Yes/No when date is in the Time Period Range. Can you share some more details how you did it ?
regards,
Har**bleep**
Hi @bhurru 2 years after is difficult to remember, but i will try.
1. first you need to have the measure switch that you can see in the post, in order to have the correct values when you select YTD;QTD;MTD in the slicer.
2. Filter timeseries: Maybe you have a chart with days or timestamp and if you select QTD you want to filter the days properly. To do that, you can create 3 little measures (YTD,QTD,MTD days) that calcualte YES/NOT if the day is YTD;QTD;MTD so you will have 3:
- YTD days: Will put yes in the days YTD
- QTD Days: will put yes only in the QTD days and NOT in rest
- MTD Days: bla bla bla
Then you need to create another measure swicht that when you select QTD take the QTD days (for example). Put this measure as a visual filter in your chart visual and prefilter by YES. with this when you click on QTD in the slicer you will see only the dates of QTD, etc etc etc
@dobregon Thanks for the Try.
However I didn't get point and 3. I'm done with Point 1 creating calc measures.
Can you please once explain these points once again ? Below is what I had done
I have created 4 columns in my calender tables IsRolling8Weeks,IsRolling26Weeks, IsRolling2Quarter etc... with values Yes or No based on Relative Weeks number and Quarter number I have calculated.
Eg. Rolling8Weeks : where Relative Week between 0 and -7 and so on for others ... (Relative Week is 0 for Max week and keep decreasing for previous weeks till start date of Calender)
Also I have to apply this slicer change in all visuals and all pages.
@bhurru 1. You need to create all the measures for your calculations of time (i imagen one for each column that you have created). the measures filtering the "yes" 2. Create a table with the "options" of time intelligence that you want to filter. i imagen that it should be the same 4 options that you have created in columns, but only one column with the 4 options as rows 3. put this as a filter slicer or in the filter pane 4. Create the general measure "hasonfilter" that depends of the options that you select in the point 3 you select the measure.
Hi Sir, your post helped me a lot. It must be hard for you to remember after 2 years. I have a question and I'm finding the answer, but not yet.
I created a filter like the way you said. My filter included: today, yesterday, last 7 days, last 30 days, current month, last month, current year, current quarter. That's all the filter I needed. But I also had a measure called "LYTD-sales" to calculate the same period last year. Here is my DAX: CALCULATE (SUM(Sales[total_sales]),DATEADD('Date'[Date],-1,YEAR))
What I want is when I choose one of the filters, "LYTD-sales" also return exactly the result for every period of time that I created. Do you have any ideas or solutions to this problem? Thank you in advance.
Welp there is Fields Parameter now
User | Count |
---|---|
90 | |
88 | |
87 | |
79 | |
49 |
User | Count |
---|---|
153 | |
145 | |
106 | |
74 | |
55 |