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 need to transform the formula below from Tableau to Power BI.
Solved! Go to Solution.
Hi @Anonymous,
So you mean you want to get the records count of the current category in one hour? If this is a case, you can extract the current date and hour with current category to calculate the count.
Measure =
VAR currDate =
MAX ( table[Data do atendimento] )
VAR _count =
CALCULATE (
COUNTROWS ( table ),
FILTER (
ALLSELECTED ( table ),
DATEVALUE ( [Data do atendimento] ) = DATEVALUE ( currDate )
&& HOUR ( [Data do atendimento] ) = HOUR ( curDate )
),
VALUES ( table[Profissional] )
)
RETURN
SWITCH ( _count, 2, 100, 3, 125)
Regards,
Xiaoxin Sheng
Hi @Anonymous ,
You can try using SWITCH () statement here.
Watch this video on how to use SWITCH() statement.
https://www.youtube.com/watch?v=-ykkaAtlCMc&vl=en
Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)
Hi @harshnathani,
Thanks for the answer.
The problem is that I have to calculate how many calls the [Profissional] made in 1 hour, and then apply the condition. If [Profissional] attends 2 in an hour (= 100), 3 in an hour (= 125) ...
I have this information to work:
Profissional | Data do atendimento |
XXX... | 09/08/2020 15:33 |
YYY... | 09/08/2020 20:56 |
XXX... | 09/08/2020 18:53 |
YYY... | 09/08/2020 19:25 |
XXX... | 09/08/2020 19:10 |
XXX... | 09/08/2020 20:49 |
Regards,
Fabrício de Dominicis
Hi @harshnathani
Is it possible to do it in Power BI?
Regards,
Fabrício de Dominicis
Hi @Anonymous,
So you mean you want to get the records count of the current category in one hour? If this is a case, you can extract the current date and hour with current category to calculate the count.
Measure =
VAR currDate =
MAX ( table[Data do atendimento] )
VAR _count =
CALCULATE (
COUNTROWS ( table ),
FILTER (
ALLSELECTED ( table ),
DATEVALUE ( [Data do atendimento] ) = DATEVALUE ( currDate )
&& HOUR ( [Data do atendimento] ) = HOUR ( curDate )
),
VALUES ( table[Profissional] )
)
RETURN
SWITCH ( _count, 2, 100, 3, 125)
Regards,
Xiaoxin Sheng
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 |
---|---|
110 | |
100 | |
80 | |
64 | |
58 |
User | Count |
---|---|
148 | |
111 | |
94 | |
84 | |
67 |