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.
Solved! Go to Solution.
Hi,
This should do the trick:
_CasesInPeak =
SUMX(
SUMMARIZE(tblPeak,[_Month],[_Day],[_Hour], "c", COUNTROWS(tblPeak)) ,
IF([c] > 200,[c],BLANK())
)
_Month = MONTH('tblPeak'[open_time])
_Day = DAY('tblPeak'[open_time])
_Hour = HOUR('tblPeak'[open_time])
_TotalCasesMinusCasesInPeak = COUNTROWS(tblPeak) - [_CasesInPeak]
As seen here (days as rows, hours in columns):
Testdata generated with:
tblPeak =
var _tbl =
SELECTCOLUMNS(
CROSSJOIN(
ROW("test", DATE(2020, 10,3)),
GENERATESERIES(1,28,1)
), "StartDate", [test], "Increment", [Value])
var _dates =
ADDCOLUMNS( _tbl, "NewDate", [StartDate]+[Increment])
return
SELECTCOLUMNS(
ADDCOLUMNS(
CROSSJOIN(
_dates, GENERATESERIES(1,1100,1)), "open_time", [NewDate] + NORM.INV(RAND(), 0.5 + ([Increment]/100), 0.08), "incident_ref", CONVERT( UNICHAR(RANDBETWEEN(65,90)),STRING) & CONVERT( UNICHAR(RANDBETWEEN(65,90)),STRING) & CONVERT( UNICHAR(RANDBETWEEN(65,90)),STRING)
), "open_time", [open_time], "incident_ref", [incident_ref]
)
Link to file.
Please mark as solution if so. Thumbs up for the effort are appreciated.
Kind regards,
Steve.
Proud to be a Super User!
Awesome Keyboard Shortcusts in Power BI, thumbs up if you like the article
My Community Blog Articles (check them out!)
My Blog - Power M code to automatically detect column types -
How to create test data using DAX!
Hi,
This should do the trick:
_CasesInPeak =
SUMX(
SUMMARIZE(tblPeak,[_Month],[_Day],[_Hour], "c", COUNTROWS(tblPeak)) ,
IF([c] > 200,[c],BLANK())
)
_Month = MONTH('tblPeak'[open_time])
_Day = DAY('tblPeak'[open_time])
_Hour = HOUR('tblPeak'[open_time])
_TotalCasesMinusCasesInPeak = COUNTROWS(tblPeak) - [_CasesInPeak]
As seen here (days as rows, hours in columns):
Testdata generated with:
tblPeak =
var _tbl =
SELECTCOLUMNS(
CROSSJOIN(
ROW("test", DATE(2020, 10,3)),
GENERATESERIES(1,28,1)
), "StartDate", [test], "Increment", [Value])
var _dates =
ADDCOLUMNS( _tbl, "NewDate", [StartDate]+[Increment])
return
SELECTCOLUMNS(
ADDCOLUMNS(
CROSSJOIN(
_dates, GENERATESERIES(1,1100,1)), "open_time", [NewDate] + NORM.INV(RAND(), 0.5 + ([Increment]/100), 0.08), "incident_ref", CONVERT( UNICHAR(RANDBETWEEN(65,90)),STRING) & CONVERT( UNICHAR(RANDBETWEEN(65,90)),STRING) & CONVERT( UNICHAR(RANDBETWEEN(65,90)),STRING)
), "open_time", [open_time], "incident_ref", [incident_ref]
)
Link to file.
Please mark as solution if so. Thumbs up for the effort are appreciated.
Kind regards,
Steve.
Proud to be a Super User!
Awesome Keyboard Shortcusts in Power BI, thumbs up if you like the article
My Community Blog Articles (check them out!)
My Blog - Power M code to automatically detect column types -
How to create test data using DAX!
Many thanks !
It works perfectly, and the dashboard is wonderfull.
Thanks again for your reactivity and help
Benjamin
Thanks 🙂
Glad to be of help!
Proud to be a Super User!
Awesome Keyboard Shortcusts in Power BI, thumbs up if you like the article
My Community Blog Articles (check them out!)
My Blog - Power M code to automatically detect column types -
How to create test data using DAX!
hi,
Thank you very much for your answers and I'm sorry if it's not really clear.
I will try the solution at work tomorrow and keep you up to date.
Benjamin
Hi,
Welcome. Will await your response tomorrow. Pls tag me in your response.
Have a nice Sunday. Kind regards, Steve
Proud to be a Super User!
Awesome Keyboard Shortcusts in Power BI, thumbs up if you like the article
My Community Blog Articles (check them out!)
My Blog - Power M code to automatically detect column types -
How to create test data using DAX!
User | Count |
---|---|
28 | |
12 | |
8 | |
7 | |
5 |
User | Count |
---|---|
35 | |
14 | |
12 | |
9 | |
7 |