Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Parihar1980
Helper II
Helper II

Where to write group by / count in this expression

 

How to write Dax expression in Power BI tabular model . Please suggest 

 

Select Count(*) , Year FROM [DBO].[Table] A
where UnitsReceived = 0
Group by Year

2 ACCEPTED SOLUTIONS
Eric_Zhang
Employee
Employee


@Parihar1980 wrote:

 

How to write Dax expression in Power BI tabular model . Please suggest 

 

Select Count(*) , Year FROM [DBO].[Table] A
where UnitsReceived = 0
Group by Year


@Parihar1980

Probably you may not need any DAX expression, as you can apply the SQL logic by using a slicer and a table visual.

 

Capture.PNG

 

Definitely you can create a calculated table with equivalent DAX.

Table 2 =
SUMMARIZE (
    ADDCOLUMNS (
        FILTER ( 'Table', 'Table'[UnitsReceived] = "0" ),
        "Year", YEAR ( 'Table'[Date] )
    ),
    [Year],
    "count", COUNTA ( 'Table'[UnitsReceived] )
)

View solution in original post

3 REPLIES 3
Eric_Zhang
Employee
Employee


@Parihar1980 wrote:

 

How to write Dax expression in Power BI tabular model . Please suggest 

 

Select Count(*) , Year FROM [DBO].[Table] A
where UnitsReceived = 0
Group by Year


@Parihar1980

Probably you may not need any DAX expression, as you can apply the SQL logic by using a slicer and a table visual.

 

Capture.PNG

 

Definitely you can create a calculated table with equivalent DAX.

Table 2 =
SUMMARIZE (
    ADDCOLUMNS (
        FILTER ( 'Table', 'Table'[UnitsReceived] = "0" ),
        "Year", YEAR ( 'Table'[Date] )
    ),
    [Year],
    "count", COUNTA ( 'Table'[UnitsReceived] )
)

thanks a lot

thanks sir 

But I am not sure when i am writing DAX code for this expression its not working

 

Select Count(*) ,[FLAG] FROM DimTable]
Group by [FLAG]

 

Kindly suggest 

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors