1

I want to have a Card in Power BI with the result of the select

SELECT TOP 1 [COLUMN] FROM [Table]
GROUP BY [COLUMN]
ORDER BY COUNT([COLUMN]) DESC

How can I do something like this in dax?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Mac
  • 21
  • 5

3 Answers3

0

create in powerbi a new table by dax:

Top1 = TopN(1, VALUES(Table__[Column1]), Table__[CountOf], DESC)

where

CountOf = CountOf = count(Table__[Column1])

enter image description here

msta42a
  • 3,601
  • 1
  • 4
  • 14
0

this is equivalent the maximum value of [COLUMN], that can be easily obtained with

MAX(Table[COLUMN])

another solution is using LASTNONBLANKVALUE

LASTNONBLANKVALUE(Table[COLUMN], Table[COLUMN])

that returns a scalar, otherwise LASTNONBLANK returns a table of a single row and a single column

LASTNONBLANK(Table[COLUMN], Table[COLUMN])
sergiom
  • 4,791
  • 3
  • 24
  • 32
0

enter image description here

My problem was solved by making a

SingleLeads = DISTINCTCOUNT(Fact_ProductRequests[COLUMN]) 

I figure this out after checking that there were repeated values ​​in the column.

It was probably, the desperation that settled in not getting the results I wanted, that made me open this question.

Thank you all.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Mac
  • 21
  • 5