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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

How to get following SQL expression in DAX?

Hi, 


So I have an SQL measure:

 

COUNT([LteRsrp]) / TOTAL(COUNT([LteRsrp]))

 

it is used to get a bar chart in Tableau, but when I use following DAX in POWER BI:

 

DIVIDE(COUNT([LteRsrp]),CALCULATE(COUNT[LteRsrp]),ALL(TABLE))

 

It actually gives me half the values in Power BI as compared to Tableau. 

 

Can anybody tell me what is the problem here?

4 REPLIES 4
v-yalanwu-msft
Community Support
Community Support

Hi, @Anonymous ;


Is the above answer helpful to you? If so, Would you mind accept the helpful replies as solutions? Then we are able to close the thread. More people who have the same requirement will find the solution quickly and benefit here. Thank you.

Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

v-yalanwu-msft
Community Support
Community Support

Hi, @Anonymous ;

If the data is inconsistent in power BI and Tableau, it may be filtered, please try it.

Measure =
DIVIDE (
    CALCULATE (
        COUNT ( [LteRsrp] ),
        FILTER ( ALL ( 'Table' ), [LteRsrp] = MAX ( [LteRsrp] ) )
    ),
    CALCULATE ( COUNT ( [LteRsrp] ), ALL ( 'Table' ) )
)

The final output is shown below:

vyalanwumsft_0-1628058600863.png

 

If not, can you share more pictures about your data after removing sensitive information?

Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Fowmy
Super User
Super User

@Anonymous 

Try this one, please?

Not sure about the columns of your table in the example, better share the screenshot of the measure

tp_test =
DIVIDE (
    COUNT ( Tablename[LteRsrp] ),
    CALCULATE ( COUNT ( Tablename[LteRsrp] ), ALLSELECTED ( Tablename ) )
)

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Anonymous
Not applicable

Here: 

armughan_0-1627906271136.png

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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