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.
I would like to know, given a certain date range, how many entries do I have, on average, per day, week and month.
So far I am creating three measures like this
average_ticket_perDay =
var nOfDays = DATEDIFF(Min(issues[created]), Max(issues[created]),Day)
var nOfRows = COUNTROWS(Issues)
Return DIVIDE(nOfRows,nOfDays)
average_ticket_perWeek =
var nOfWeeks = DATEDIFF(Min(issues[created]), Max(issues[created]),Week)
var nOfRows = COUNTROWS(Issues)
Return DIVIDE(nOfRows,nOfWeeks)
average_ticket_perMonth =
var nOfMonths = DATEDIFF(Min(issues[created]), Max(issues[created]),Month)
var nOfRows = COUNTROWS(Issues)
Return DIVIDE(nOfRows,nOfMonths)
And then I put three visuals with the tree informations.
Question:
Is it possibile to get this information only with a single visual?
Alternative question:
Is it possible to create only one measure and the DateDiff interval changes Dinamically?
Solved! Go to Solution.
Hi, @fabiomanniti
According to your description, I think you can create a singe table column as slicer, then you can choose day,week,month you want to control the result dynamically.
Like this:
average_ticket =
VAR nOfRows =
COUNTROWS ( Issues )
VAR nOfDays =
DATEDIFF ( MIN ( issues[created] ), MAX ( issues[created] ), DAY )
VAR nOfWeeks =
DATEDIFF ( MIN ( issues[created] ), MAX ( issues[created] ), WEEK )
VAR nOfMonths =
DATEDIFF ( MIN ( issues[created] ), MAX ( issues[created] ), MONTH )
VAR nofRD =
DIVIDE ( nOfRows, nOfDays )
VAR nofRW =
DIVIDE ( nOfRows, nOfWeeks )
VAR nofRM =
DIVIDE ( nOfRows, nOfMonths )
RETURN
SWITCH (
TRUE (),
SELECTEDVALUE ( table[date] ) = "Day", nofRD,
SELECTEDVALUE ( table[date] ) = "Week", nofRW,
SELECTEDVALUE ( table[date] ) = "Month", nofRM
)
Did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please upload some insensitive data samples and expected output.
Best Regards,
Community Support Team _ Janey
Hi, @fabiomanniti
According to your description, I think you can create a singe table column as slicer, then you can choose day,week,month you want to control the result dynamically.
Like this:
average_ticket =
VAR nOfRows =
COUNTROWS ( Issues )
VAR nOfDays =
DATEDIFF ( MIN ( issues[created] ), MAX ( issues[created] ), DAY )
VAR nOfWeeks =
DATEDIFF ( MIN ( issues[created] ), MAX ( issues[created] ), WEEK )
VAR nOfMonths =
DATEDIFF ( MIN ( issues[created] ), MAX ( issues[created] ), MONTH )
VAR nofRD =
DIVIDE ( nOfRows, nOfDays )
VAR nofRW =
DIVIDE ( nOfRows, nOfWeeks )
VAR nofRM =
DIVIDE ( nOfRows, nOfMonths )
RETURN
SWITCH (
TRUE (),
SELECTEDVALUE ( table[date] ) = "Day", nofRD,
SELECTEDVALUE ( table[date] ) = "Week", nofRW,
SELECTEDVALUE ( table[date] ) = "Month", nofRM
)
Did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please upload some insensitive data samples and expected output.
Best Regards,
Community Support Team _ Janey
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 |
---|---|
114 | |
99 | |
83 | |
70 | |
60 |
User | Count |
---|---|
150 | |
115 | |
104 | |
89 | |
65 |