Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi All,
I'm trying to write a DAX Measure to determine how many transactions are breakfast vs lunch. This is what I have but its not working. Any idea what I'm doing wrong?
Solved! Go to Solution.
@am_i_really Sorry, I had some syntax errors in that, try this:
Measure Breakfast =
VAR __Table =
ADDCOLUMNS(
'Table',
"__Type", IF([Order Time] < TIME(11,00,00),"Breakfast", "Lunch")
)
VAR __Result = COUNTROWS(FILTER(__Table, [__Type] = "Breakfast"))
RETURN
__Result
@am_i_really Try below. However, this is very dependent on the format of your Order Time column, can you post an example of your data?
Measure Breakfast =
VAR __Table =
ADDCOLUMNS(
'Master',
"__Type", IF([Order Time]) < TIME(11,00,00),"Breakfast", "Lunch")
)
VAR __Result = COUNTROWS(FILTER(__Table, [__Type] = "Breakfast"
RETURN
__Result
@am_i_really Sorry, I had some syntax errors in that, try this:
Measure Breakfast =
VAR __Table =
ADDCOLUMNS(
'Table',
"__Type", IF([Order Time] < TIME(11,00,00),"Breakfast", "Lunch")
)
VAR __Result = COUNTROWS(FILTER(__Table, [__Type] = "Breakfast"))
RETURN
__Result
User | Count |
---|---|
25 | |
12 | |
8 | |
6 | |
6 |
User | Count |
---|---|
26 | |
12 | |
11 | |
8 | |
7 |