Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hi,
I want to create the count in query but this show syntax error.
Please help.
IF(MONTH([Created Date])=MONTH([Restoration Date]) &&
YEAR([Created Date])=YEAR([Restoration Date])),1,0)
Solved! Go to Solution.
@PBI_newuser , The syntax you have give is DAX and you trying in power query.
DAX
IF(MONTH([Created Date])=MONTH([Restoration Date]) && YEAR([Created Date])=YEAR([Restoration Date]),1,0)
Power Query /M
if Date.Month([Created Date])=Date.Month([Restoration Date]) and Date.Year([Created Date])=Date.Year([Restoration Date]) then 1 else 0
if Date.Month([Created Date])=Date.Month([Restoration Date]) && Date.Year([Created Date])=Date.Year([Restoration Date]) then 1 else 0
Hi,
In the Query Editor, try this
=if Date.Month([Created Date])=Date.Month([Restoration Date]) and Date.Year([Created Date])=Date.Year([Restoration Date]) then 1 else 0
Hope this helps.
@PBI_newuser - Check out this blog article, it's older but still relevant today and will help you in the future I think:
https://community.powerbi.com/t5/Community-Blog/The-Languages-of-Power-BI/ba-p/69104
hi @PBI_newuser - try the below; I think you are missing a coupe of brackets
IF( ( MONTH( [Created Date] )=MONTH( [Restoration Date] ) ) && ( YEAR([Created Date] )=YEAR( [Restoration Date] ) ), 1, 0)
Proud to be a Super User!
hi, if you are using Power Query to create the column then this is the syntax you should use:
if ( Date.Month([Date ID])=Date.Month([First Day of Month]) and Date.Year([Date ID])=Date.Year( [First Day of Month] ) ) then 1 else 0
Note: the column names in the below screenshot are from my data model
Proud to be a Super User!
IF(MONTH([Created Date])=MONTH([Restoration Date]) &&
YEAR([Created Date])=YEAR([Restoration Date]),1,0)
Hi,
In the Query Editor, try this
=if Date.Month([Created Date])=Date.Month([Restoration Date]) and Date.Year([Created Date])=Date.Year([Restoration Date]) then 1 else 0
Hope this helps.
@PBI_newuser , The syntax you have give is DAX and you trying in power query.
DAX
IF(MONTH([Created Date])=MONTH([Restoration Date]) && YEAR([Created Date])=YEAR([Restoration Date]),1,0)
Power Query /M
if Date.Month([Created Date])=Date.Month([Restoration Date]) and Date.Year([Created Date])=Date.Year([Restoration Date]) then 1 else 0
if Date.Month([Created Date])=Date.Month([Restoration Date]) && Date.Year([Created Date])=Date.Year([Restoration Date]) then 1 else 0
@PBI_newuser , a new column
countrows(distinct(except(selectcolumns(filter(Table,Table[Category] ="B"), "ID", Table[ID]),selectcolumns(filter(Table,Table[Category] ="A"), "ID", Table[ID]))))
User | Count |
---|---|
123 | |
76 | |
62 | |
50 | |
50 |
User | Count |
---|---|
175 | |
125 | |
60 | |
60 | |
58 |