Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi,
I'm doing some calculations where I calculate the values +1 day and +8 days against the selected date. But when I'm selecting a date in first table the date doesn't change in the other tables. I tried using it with a date table and also creating extra columns in my Table1 but nothing seems to work. Can someone help me and tell me if it is even possible?
#1
#2
When selected the expected date should be:
demand vs supply = Selected date (ex. 12/06/2019)
+1 day = Selected date +1 (ex. 12/07/2019)
+8 day = Selected date +8 (ex. 12/14/2019)
Relationships
I'm not using any, everything is data from the same view. I can use a date table and for the the relationship would be:
date | one to Many (1:*) | table
Data
The data is saved in a pivoted table where the column names are in 'attribute_name' and the values from the table are in 'value'.
Measure's
I'm using 2 measures to calculate the difference for the +1 Day and 2 measures to calculate +8 Days. Below is the one for +1 Day.
Measure 1 - getting the value for +1 day
#1_Selecting_+1Day = VAR PriorDay = SELECTEDVALUE(table1[date])+1
RETURN
CALCULATE(
( SUM(table1[Value])),
ALL ( table1[date]),
table1[date] = PriorDay
)
Measure 2 - getting the difference for the two days.
I hope someone can help me, if you need more information please let me know.
Solved! Go to Solution.
Hi @Anonymous ,
You need measures as below:
For +1 day:
+1day = SELECTEDVALUE('Table'[Date])+1
+1 value = SELECTEDVALUE('Table'[Value])+1
For +8 days:
+8 day = SELECTEDVALUE('Table'[Date])+8
+8 value = SELECTEDVALUE('Table'[Value])+8
Finally ,you will see:
For the related .pbix file,pls click here.
Best Regards,
Kelly
Hi @Anonymous ,
You need measures as below:
For +1 day:
+1day = SELECTEDVALUE('Table'[Date])+1
+1 value = SELECTEDVALUE('Table'[Value])+1
For +8 days:
+8 day = SELECTEDVALUE('Table'[Date])+8
+8 value = SELECTEDVALUE('Table'[Value])+8
Finally ,you will see:
For the related .pbix file,pls click here.
Best Regards,
Kelly
The first formula is exactly what I need. But I can't put that measure as my rows in my matrix table. There is a work around for putting a measure in, so i'm going to try that.
In case you need for comparison, First, create a calendar table and mark it as Date. Join it with the date of your table
One Day behind =Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Day))
8Day behind =Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-8,Day))
One Day ahead =Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],1,Day))
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s.
Refer
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/
Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners , HR-Analytics-Active-Employee-Hire-and-Termination-trend
Power-BI-Working-with-Non-Standard-Time-Periods And Comparing-Data-Across-Date-Ranges
Connect on Linkedin
I created the calendar table and joined it with my table. The comparing is going good but my dates are still staying the same.
Please provide a sample what you want to show vs what you are getting
I updated the post with a foto of the expected result I'm trying to get.
Not sure I still got it.
But if we want to show date of 7th and show diff 6th and 7th we use -1 day measure
but If want show same on 6th we will use +1 day measure
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
99 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
102 | |
87 | |
64 |