March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi Guys
I want the when the user select a date a series of months shows in line chart based on selected date as below:
I tried start date as selected value and end date as selected value - 365 but it didn't work.
could anyone help please.
Solved! Go to Solution.
Hi, @AsNa_92
The reason why this date is repeated is that I changed the date format to MMMM-YYYY for this date table, which is actually every day, as shown in the figure below:
To eliminate this duplication, we need to create a new column in the date table, Month&Year:
Moth&Year = FORMAT('Date table'[Date],"MMM-YY")
Place this column in the slicer:
Use the following measure2:
Measure2 =
VAR _seleted_day = CALCULATE(MAX('Date table'[Date]),'Date table'[Moth&Year]=SELECTEDVALUE('Date table'[Moth&Year]))
VAR _seleted_day_365 = _seleted_day-365
VAR _filter_value = CALCULATE(SUM('Table'[Value]),FILTER('Table','Table'[DATE]>=_seleted_day_365&&'Table'[DATE]<=_seleted_day))
RETURN IF(ISFILTERED('Date table'[Moth&Year]),_filter_value,SUM('Table'[Value]))
Here are the results:
The reason why Feb2024, the linechart shows Jan2024 is that choosing the second Feb2024 is actually choosing the date as shown in the image below:
You can correct this with the method I just mentioned:
I've provided the PBIX file used this time below.
How to Get Your Question Answered Quickly
If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .
Best Regards
Jianpeng Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks @Sergii24 and @vanessafvg
Hi, @AsNa_92
Based on your description and the data provided, you want to use the year, month, and month selected by the slicer as the end date of 365 days. The selected month and year are used as the start date. First of all, you need to generate a calculation table of the date column based on your date column, this table does not need to establish a relationship with the original table, this table is mainly used for slicers and filtering data.
Date table = CALENDAR(MIN('Table'[DATE]),MAX('Table'[DATE]))
You'll need to create the following measure and place it in your line chart:
Measure =
VAR _seleted_day = SELECTEDVALUE('Date table'[Date])
VAR _seleted_day_365 = DATEADD('Date table'[Date],-12,MONTH)
VAR _filter_value = CALCULATE(SUM('Table'[Value]),FILTER('Table','Table'[DATE]>=_seleted_day_365&&'Table'[DATE]<=_seleted_day))
RETURN IF(ISFILTERED('Date table'[Date]),_filter_value,SUM('Table'[Value]))
Here are the results:
If you want 2024 to appear at the beginning, you can adjust it like this:
I provide the PBIX file used this time below.
How to Get Your Question Answered Quickly
If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .
Best Regards
Jianpeng Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks for the reply and it works, but why the date is duplicated? ( I want the slicer to be single select)
and If i selected another date of Feb2024, the linechart shows Jan2024:
Hi, @AsNa_92
The reason why this date is repeated is that I changed the date format to MMMM-YYYY for this date table, which is actually every day, as shown in the figure below:
To eliminate this duplication, we need to create a new column in the date table, Month&Year:
Moth&Year = FORMAT('Date table'[Date],"MMM-YY")
Place this column in the slicer:
Use the following measure2:
Measure2 =
VAR _seleted_day = CALCULATE(MAX('Date table'[Date]),'Date table'[Moth&Year]=SELECTEDVALUE('Date table'[Moth&Year]))
VAR _seleted_day_365 = _seleted_day-365
VAR _filter_value = CALCULATE(SUM('Table'[Value]),FILTER('Table','Table'[DATE]>=_seleted_day_365&&'Table'[DATE]<=_seleted_day))
RETURN IF(ISFILTERED('Date table'[Moth&Year]),_filter_value,SUM('Table'[Value]))
Here are the results:
The reason why Feb2024, the linechart shows Jan2024 is that choosing the second Feb2024 is actually choosing the date as shown in the image below:
You can correct this with the method I just mentioned:
I've provided the PBIX file used this time below.
How to Get Your Question Answered Quickly
If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .
Best Regards
Jianpeng Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
please provide some sample data with your expected solution.
also how is your model setup? do you have a separate date table, do you you have proper dates? the quality of the solution will be based on the information provided.
Proud to be a Super User!
Hi @vanessafvg
I don't have date table and if I created one it would be more difficult since I have other pages and tables that has mapping with a master table.
The line chart has a filter of (TYPE=QR) and (Attribute=MASS and GROSS RATE)
please find below a sample data:
TYPE | DATE | Attribute | Value |
QR | 12/31/2022 0:00 | MASS | 3.645585 |
QR | 12/31/2022 0:00 | GROSS RATE | 3.55798 |
QR | 12/31/2022 0:00 | NET RATE | -0.08761 |
QR | 1/31/2023 0:00 | MASS | 3.910575 |
QR | 1/31/2023 0:00 | GROSS RATE | 3.731553 |
QR | 1/31/2023 0:00 | NET RATE | -0.17902 |
QR | 2/28/2023 0:00 | MASS | 4.134447 |
QR | 2/28/2023 0:00 | GROSS RATE | 3.935703 |
QR | 2/28/2023 0:00 | NET RATE | -0.19874 |
QR | 3/31/2023 0:00 | MASS | 4.312843 |
QR | 3/31/2023 0:00 | GROSS RATE | 4.272507 |
QR | 3/31/2023 0:00 | NET RATE | -0.04034 |
QR | 4/30/2023 0:00 | MASS | 4.570048 |
QR | 4/30/2023 0:00 | GROSS RATE | 4.472209 |
QR | 4/30/2023 0:00 | NET RATE | -0.09784 |
QR | 5/31/2023 0:00 | MASS | 4.958814 |
QR | 5/31/2023 0:00 | GROSS RATE | 4.68387 |
QR | 5/31/2023 0:00 | NET RATE | -0.27494 |
QR | 6/30/2023 0:00 | MASS | 5.069737 |
QR | 6/30/2023 0:00 | GROSS RATE | 4.805832 |
QR | 6/30/2023 0:00 | NET RATE | -0.2639 |
QR | 7/31/2023 0:00 | MASS | 5.190224 |
QR | 7/31/2023 0:00 | GROSS RATE | 4.952592 |
QR | 7/31/2023 0:00 | NET RATE | -0.23763 |
QR | 8/31/2023 0:00 | MASS | 5.328825 |
QR | 8/31/2023 0:00 | GROSS RATE | 5.155238 |
QR | 8/31/2023 0:00 | NET RATE | -0.17359 |
QR | 9/30/2023 0:00 | MASS | 5.336291 |
QR | 9/30/2023 0:00 | GROSS RATE | 5.155951 |
QR | 9/30/2023 0:00 | NET RATE | -0.18034 |
QR | 10/31/2023 0:00 | MASS | 5.359936 |
QR | 10/31/2023 0:00 | GROSS RATE | 5.37812 |
QR | 10/31/2023 0:00 | NET RATE | 0.018184 |
QR | 11/30/2023 0:00 | MASS | 5.451271 |
QR | 11/30/2023 0:00 | GROSS RATE | 5.334495 |
QR | 11/30/2023 0:00 | NET RATE | -0.11678 |
QR | 12/31/2023 0:00 | MASS | 5.350216 |
QR | 12/31/2023 0:00 | GROSS RATE | 5.289587 |
QR | 12/31/2023 0:00 | NET RATE | -0.06063 |
QR | 1/31/2024 0:00 | MASS | 5.276858 |
QR | 1/31/2024 0:00 | GROSS RATE | 5.235922 |
QR | 1/31/2024 0:00 | NET RATE | -0.04094 |
QR | 2/29/2024 0:00 | MASS | 5.241739 |
QR | 2/29/2024 0:00 | GROSS RATE | 5.140349 |
QR | 2/29/2024 0:00 | NET RATE | -0.10139 |
BR | 12/31/2022 0:00 | MASS | 3.669163 |
BR | 12/31/2022 0:00 | GROSS RATE | 4.025409 |
BR | 12/31/2022 0:00 | NET RATE | 0.356246 |
BR | 1/31/2023 0:00 | MASS | 3.94377 |
BR | 1/31/2023 0:00 | GROSS RATE | 4.232851 |
BR | 1/31/2023 0:00 | NET RATE | 0.289081 |
BR | 2/28/2023 0:00 | MASS | 4.162243 |
BR | 2/28/2023 0:00 | GROSS RATE | 4.2254 |
BR | 2/28/2023 0:00 | NET RATE | 0.063157 |
BR | 3/31/2023 0:00 | MASS | 4.33412 |
BR | 3/31/2023 0:00 | GROSS RATE | 4.437535 |
BR | 3/31/2023 0:00 | NET RATE | 0.103415 |
BR | 4/30/2023 0:00 | MASS | 4.600813 |
BR | 4/30/2023 0:00 | GROSS RATE | 4.481358 |
BR | 4/30/2023 0:00 | NET RATE | -0.11946 |
BR | 5/31/2023 0:00 | MASS | 4.960991 |
BR | 5/31/2023 0:00 | GROSS RATE | 4.741326 |
BR | 5/31/2023 0:00 | NET RATE | -0.21967 |
BR | 6/30/2023 0:00 | MASS | 5.084874 |
BR | 6/30/2023 0:00 | GROSS RATE | 4.655785 |
BR | 6/30/2023 0:00 | NET RATE | -0.42909 |
BR | 7/31/2023 0:00 | MASS | 5.205353 |
BR | 7/31/2023 0:00 | GROSS RATE | 4.925531 |
BR | 7/31/2023 0:00 | NET RATE | -0.27982 |
BR | 8/31/2023 0:00 | MASS | 5.337966 |
BR | 8/31/2023 0:00 | GROSS RATE | 5.169445 |
BR | 8/31/2023 0:00 | NET RATE | -0.16852 |
BR | 9/30/2023 0:00 | MASS | 5.347643 |
BR | 9/30/2023 0:00 | GROSS RATE | 5.120201 |
BR | 9/30/2023 0:00 | NET RATE | -0.22744 |
BR | 10/31/2023 0:00 | MASS | 5.380123 |
BR | 10/31/2023 0:00 | GROSS RATE | 5.232378 |
BR | 10/31/2023 0:00 | NET RATE | -0.14774 |
BR | 11/30/2023 0:00 | MASS | 5.477782 |
BR | 11/30/2023 0:00 | GROSS RATE | 5.054409 |
BR | 11/30/2023 0:00 | NET RATE | -0.42337 |
BR | 12/31/2023 0:00 | MASS | 5.380563 |
BR | 12/31/2023 0:00 | GROSS RATE | 4.99344 |
BR | 12/31/2023 0:00 | NET RATE | -0.38712 |
BR | 1/31/2024 0:00 | MASS | 5.287767 |
BR | 1/31/2024 0:00 | GROSS RATE | 4.987037 |
BR | 1/31/2024 0:00 | NET RATE | -0.30073 |
BR | 2/29/2024 0:00 | MASS | 5.244648 |
BR | 2/29/2024 0:00 | GROSS RATE | 4.871114 |
BR | 2/29/2024 0:00 | NET RATE | -0.37353 |
Total | 12/31/2022 0:00 | MASS | 3.656715 |
Total | 12/31/2022 0:00 | GROSS RATE | 3.778621 |
Total | 12/31/2022 0:00 | NET RATE | 0.121906 |
Total | 1/31/2023 0:00 | MASS | 3.925667 |
Total | 1/31/2023 0:00 | GROSS RATE | 3.959465 |
Total | 1/31/2023 0:00 | NET RATE | 0.033797 |
Total | 2/28/2023 0:00 | MASS | 4.146172 |
Total | 2/28/2023 0:00 | GROSS RATE | 4.057905 |
Total | 2/28/2023 0:00 | NET RATE | -0.08827 |
Total | 3/31/2023 0:00 | MASS | 4.321593 |
Total | 3/31/2023 0:00 | GROSS RATE | 4.340376 |
Total | 3/31/2023 0:00 | NET RATE | 0.018782 |
Total | 4/30/2023 0:00 | MASS | 4.582402 |
Total | 4/30/2023 0:00 | GROSS RATE | 4.475882 |
Total | 4/30/2023 0:00 | NET RATE | -0.10652 |
Total | 5/31/2023 0:00 | MASS | 4.959656 |
Total | 5/31/2023 0:00 | GROSS RATE | 4.706083 |
Total | 5/31/2023 0:00 | NET RATE | -0.25357 |
Total | 6/30/2023 0:00 | MASS | 5.075227 |
Total | 6/30/2023 0:00 | GROSS RATE | 4.751415 |
Total | 6/30/2023 0:00 | NET RATE | -0.32381 |
Total | 7/31/2023 0:00 | MASS | 5.195261 |
Total | 7/31/2023 0:00 | GROSS RATE | 4.943583 |
Total | 7/31/2023 0:00 | NET RATE | -0.25168 |
Total | 8/31/2023 0:00 | MASS | 5.331771 |
Total | 8/31/2023 0:00 | GROSS RATE | 5.159817 |
Total | 8/31/2023 0:00 | NET RATE | -0.17195 |
Total | 9/30/2023 0:00 | MASS | 5.339834 |
Total | 9/30/2023 0:00 | GROSS RATE | 5.144794 |
Total | 9/30/2023 0:00 | NET RATE | -0.19504 |
Total | 10/31/2023 0:00 | MASS | 5.365898 |
Total | 10/31/2023 0:00 | GROSS RATE | 5.335075 |
Total | 10/31/2023 0:00 | NET RATE | -0.03082 |
Total | 11/30/2023 0:00 | MASS | 5.459033 |
Total | 11/30/2023 0:00 | GROSS RATE | 5.252494 |
Total | 11/30/2023 0:00 | NET RATE | -0.20654 |
Total | 12/31/2023 0:00 | MASS | 5.359022 |
Total | 12/31/2023 0:00 | GROSS RATE | 5.203653 |
Total | 12/31/2023 0:00 | NET RATE | -0.15537 |
Total | 1/31/2024 0:00 | MASS | 5.279937 |
Total | 1/31/2024 0:00 | GROSS RATE | 5.165688 |
Total | 1/31/2024 0:00 | NET RATE | -0.11425 |
Total | 2/29/2024 0:00 | MASS | 5.242518 |
Total | 2/29/2024 0:00 | GROSS RATE | 5.068287 |
Total | 2/29/2024 0:00 | NET RATE | -0.17423 |
Hi @AsNa_92, I believe the problem statement is still unclear... What 2 lines are representing? What do you want to happen when you select Feb2024?
Hi @Sergii24
the 2 lines are the Attribute and I want to show their values based on the selected date as end date and the start date should be one year age.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
133 | |
90 | |
88 | |
64 | |
58 |
User | Count |
---|---|
201 | |
137 | |
107 | |
70 | |
68 |