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.
Can anyone help me to rewrite the below Tableau calculation into Power BI please? I have tried below PBI calculation but it doesnt return the desired outout. I have also attached tableau report screenshot for better understanding what the calculation looks like
Tableau Calculation:
Count Group = {fixed [Wholesale Parent],YEAR([Post DATE]),[Location Sub Type] :IF countd([Location#]) = 1
THEN '1 Location'
ELSEIF countd([Location#]) > 1 AND COUNTD([Location#])<= 5
THEN '2-5 locations'
ELSEIF countd([Location#]) > 5 AND COUNTD([Location#]) <=10
THEN '6-10 locations'
ELSEIF countd([Location#]) > 10 and COUNTD([Location#]) <= 20
THEN '11 - 20 Locations'
ELSE
'20+ Locations'
END }
Power BI Calculation:
count grp =
var _year = SELECTEDVALUE(Datetable[Year])
var _acountgrp = CALCULATE(DISTINCTCOUNT(LOCATIONS[LOCATION_NUM]),Datetable.[Year] = _year)
RETURN SWITCH(TRUE(),
_acountgrp = 0, "no Locations",
_acountgrp = 1, "1 Location",
_acountgrp <= 5, "2-5 Locations",
_acountgrp <= 10, "6-10 Locations",
_acountgrp <= 20, "11-20 Locations",
"20+ Locations")
Thank you so much for the response! The above calculation is a measure however i cant add measure to the rows right in a matrix table. if you look at the tableau report screenshot that is attached in the beginning on this post, it has count grp (group category) on the rows based on the condition. in the screenshot which is attached to this message i created a table "Locations" with just one column (Group) having 5 rows using "Enter Data " with the count grp (group categories) and to this when i drag the measure which you shared it is returning "no locations" which is group category name but ideally it should be returning distinct count of "wholesale Parent Name". Is there a way to create the group category name with If, else statement by distinct counting the field 'wholesale parent name?' Please let me know if you need further clarifications
Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-...
Please show the expected outcome based on the sample data you provided.
https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
118 | |
84 | |
49 | |
38 | |
30 |
User | Count |
---|---|
188 | |
76 | |
73 | |
54 | |
45 |