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 Everyone.
I have two table name Date table and fact table. I have date slicer that is using Date Table. Date table is connected with startdate column. I would like to display the Average of column score in fact table if the slicer selection is between column startdate and enddate. Anyone have idea how to do this?
Thank you!
Solved! Go to Solution.
Hi @Anonymous
Try this measure:
Avg. Score Selected Date =
Var _Max_Selected_Date = MAX('Date table'[Date])
Var _Filtered_Fact_Table =
CALCULATETABLE(
FILTER(
'Fact Table',
'Fact Table'[StartDate]<=_Max_Selected_Date&&'Fact Table'[EndDate]>=_Max_Selected_Date
),
CROSSFILTER('Date table'[Date],'Fact Table'[StartDate],None)
)
RETURN
AVERAGEX(_Filtered_Fact_Table,[Score])
Output:
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
o achieve this in Power BI, ensure your Date table is related to the Fact table via the startdate column. Then, use a measure to calculate the average score where the slicer selection is between the startdate and enddate.
Finally, add this measure to your visual, and it will reflect the correct average based on the slicer selection.
A business school provides education in business administration and management, offering programs like MBAs and specialized degrees to develop skills in finance, marketing, strategy, and leadership for professional advancement.
A medical school educates future doctors, offering rigorous training in medical science, clinical practice, and patient care, leading to an MD or DO degree, essential for a career in medicine.
A medical school educates future doctors, offering rigorous training in medical science, clinical practice, and patient care, leading to an MD or DO degree, essential for a career in medicine.
A medical school educates future doctors, offering rigorous training in medical science, clinical practice, and patient care, leading to an MD or DO degree, essential for a career in medicine.
Hi,
To achieve this, you can use a DAX measure in Power BI that calculates the average of the score column in your fact table, taking into account the date slicer that is based on the Date table and filtering between the startdate and enddate columns. Here’s a step-by-step guide on how to create this measure:
Ensure Relationships: Verify that your Date table is correctly related to your fact table through the startdate column.
Create the Measure: Use the following DAX code to create a measure that calculates the average score within the specified date range.
Feel free to ask on Yacine TV if you have any more questions or need further assistance!
Thank you!
To achieve this, you can create a measure in Power BI using DAX. First, create a measure for the average score in your fact table. Then, use the FILTER function to filter the fact table based on the selected date range from the slicer url using RELATED function to relate the date column in the fact table to the date column in the date table. Finally, calculate the average score within this filtered context. Your measure would look something like this:
This measure will dynamically calculate the average score based on the selected date range from the slicer.
Hello! It looks like you're looking to perform a filtering and averaging operation based on date segmentation. Here's a general approach you could take, assuming you're working with some query language or data manipulation like SQL.
Let's say you have two tables: DateTable, and FactsTable. Here's an example of how you might structure your query:
In this consultation:
Be sure to replace SelectedDate with the actual variable or value you get from the date slicer.
This is a general example and you may need to adjust the GB WhatsApp syntax depending on the database management system you're using and the exact structure of your tables. If you're using a different environment or if you have more details about your setup, it might provide a more specific answer. GB WhatsApp APK
Hi,
Based on that data that you have shared, show the expected result.
Hello
You can use the following SQL query to get the average of the fact column based on date targeting:
Here:
Adjust according to your specific DBMS and table structure. Install AN WhatsApp Now
sorry, there additional column name 'project' as below;
Example if project is A and date selection is May - 23 (within startdate 7 enddate) then 4, if project is A and date selection is Jan - 23(outside startdate & enddate) then Blank
Hi @Anonymous
Try this measure:
Avg. Score Selected Date =
Var _Max_Selected_Date = MAX('Date table'[Date])
Var _Filtered_Fact_Table =
CALCULATETABLE(
FILTER(
'Fact Table',
'Fact Table'[StartDate]<=_Max_Selected_Date&&'Fact Table'[EndDate]>=_Max_Selected_Date
),
CROSSFILTER('Date table'[Date],'Fact Table'[StartDate],None)
)
RETURN
AVERAGEX(_Filtered_Fact_Table,[Score])
Output:
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
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 |
---|---|
128 | |
90 | |
75 | |
56 | |
53 |
User | Count |
---|---|
200 | |
104 | |
101 | |
67 | |
55 |