Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi there
I try convert my string to sha256 with r-script function:
library(digest)
apikey <- "hello"
apimessage <-"world"
hash <- digest::hmac(apikey,apimessage, algo="sha256", serialize=F)
I found similar thread here : https://community.powerbi.com/t5/Desktop/Invoke-Function-writtein-in-R/td-p/87438
but i still cant convert to powerbi function.
This is my file: https://drive.google.com/open?id=1wrZQgzeW8uvy7cNRWKPuiqICYhPfp6wc
Please help me convert it.
Thank you so much
Solved! Go to Solution.
Hi sontt,
To achieve your requirement, please refer to R Script:
# 'dataset' holds the input data for this script
library(digest)
len <- length(dataset[[1]])
hash <- c()
for (i in 1:len) {
hash <- append(hash, digest::hmac(dataset[i, 1],dataset[i, 2], algo="sha256", serialize=F))
}
dataset$hash <- hash
result <- dataset
The result is like below and you can refer to PBIX file here:
https://www.dropbox.com/s/ykto8cwdrwg2gl8/For%20sontt.pbix?dl=0
Best Regards,
Jimmy Tao
Hi sontt,
To achieve your requirement, please refer to R Script:
# 'dataset' holds the input data for this script
library(digest)
len <- length(dataset[[1]])
hash <- c()
for (i in 1:len) {
hash <- append(hash, digest::hmac(dataset[i, 1],dataset[i, 2], algo="sha256", serialize=F))
}
dataset$hash <- hash
result <- dataset
The result is like below and you can refer to PBIX file here:
https://www.dropbox.com/s/ykto8cwdrwg2gl8/For%20sontt.pbix?dl=0
Best Regards,
Jimmy Tao
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 37 | |
| 33 | |
| 32 | |
| 31 | |
| 26 |
| User | Count |
|---|---|
| 134 | |
| 96 | |
| 78 | |
| 67 | |
| 65 |