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.
Hi,
I would like for the value in my Count column to change from a 1 to a 0.5 but only if the person's name in my Scheduled Person column is the same 2 days in a row (back to back days) from my Appt date column. Also the Procedure needs to be equal to A and the Center needs to be equal B.
Solved! Go to Solution.
Here is the code with the solution. The main part is the group-by with group-kind local as 4th argument (no in the UI). Good luck.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("ZcxLCsAgDIThu2QtTJKqrcs+LxG8/zVaQhVLYVYfw29GCTJBWZUCrVSDUYQsTTaXAslNdhcRPHvpcMrD6XThAu6lq9P8JWFw/FMaqN4=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Date = _t, Person = _t]),
#"Changed Type with Locale" = Table.TransformColumnTypes(Source, {{"Date", type date}}, "en-US"),
SortedRows = Table.Buffer(Table.Sort(#"Changed Type with Locale",{{"Date", Order.Ascending}})),
#"Grouped Rows" = Table.Group(SortedRows, {"Person"}, {{"Count local", each Table.RowCount(_), Int64.Type}, {"Data", each _, type table [Date=nullable date, Person=nullable text]}}, GroupKind.Local),
#"Removed Columns" = Table.RemoveColumns(#"Grouped Rows",{"Person"}),
#"Expanded Data" = Table.ExpandTableColumn(#"Removed Columns", "Data", {"Date", "Person"}, {"Date", "Person"}),
#"Added Custom" = Table.AddColumn(#"Expanded Data", "factor", each if [Count local] >= 2 then 0.5 else 1)
in
#"Added Custom"
Do you have a custom solution in DAX? I have to insert multiple arguments depending on the type of procedure and center location. Thank you.
The solution can be found here:
User | Count |
---|---|
24 | |
10 | |
8 | |
7 | |
6 |
User | Count |
---|---|
31 | |
12 | |
10 | |
10 | |
9 |