The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hey,
Would you have an idea to simplify my dax calcul ?
I want to do this for a month, so it's more complicated.
@Anonymous Perhaps use MONTH and YEAR to get the month and year of your [Date] and then use a CALCULATE(SUM where the month and year of the [Date] equals those values? Hard to determine what exactly you are trying to do.
Sorry, having trouble following, can you post sample data as text and expected output?
Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882
Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.
Hi, thanks for your answer.
The fact is that i need to do a weighted average on a month, (like what i did for the week). As you can see the second variable [Nombre de sessions cumulées par semaine] isn't affected by the date (dateadd).
To simplify i want to do exactely the same thing you can see on the screen with only function if it does exist.
@Anonymous Again, not following. First, I don't see any variables (VAR statements) in your code. And where the weighted average comes into play is not clear. I would have never guessed that was a weighted average formula. Without example data and expected output, it's hard to tell you what you need to do.
I'll give you an example of what i actually want on excel.
There is the context :
I want to calculate the cumulative average time by session for the day 5 for example.
So I start by calculating each day, depending on the number of session, the average time by session and the cumulative session which is the sum of all the sessions.
Then to have my result i need to sum all of them,
I want to do the same on power bi on a month period for each day.
Example : if i choose the 1st February, i want the cumulative average time by session from 1st January to 1st February.
Sorry if i'm not clear enough, my english isn't the best.
Thanks for your answers.
@Anonymous So typically I would do something like that this way:
Measure =
VAR __Date = MAX(Dates[Date])
VAR __MonthAgo = DATE(YEAR(EOMONTH(__Date,-1)),MONTH(EOMONTH(__Date,-1)),DAY(__Date))
VAR __Table = ADDCOLUMNS(FILTER(ALL('Dates'),[Date]>=__MonthAgo && [Date]<=__Date),"__MyCalc",[your daily calculation goes here])
RETURN
SUMX(__Table,[__MyCalc])
Thanks,
But what i ask for is to be able to use the cumulative session value of the day 5 for the calcul of all the other day. It need to be the same because it depend of the last day while the number of session and the average time is different each time. Let me know if i'm not clear enough.
User | Count |
---|---|
16 | |
8 | |
7 | |
6 | |
6 |
User | Count |
---|---|
26 | |
13 | |
12 | |
9 | |
8 |