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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
PrivateAnalytic
Helper IV
Helper IV

DAX Formula and Measure Question

Hello everyone! My data is depicted below (1st picture). It is pretty simple, I created the Total Subtasks Completed and the % of PP Progress columns. The total subtasks completed is the sum of the all the different subtask result columns, and the % of PP progress uses the values in the Total Subtasks completed columns divided by 17 because thats how many different subtasks there are. On the second picture I attached, I made a quick table visual which shows how many subtasks and their % of PP progress a person has. I was looking to create a measure or column which can bucket the % of PP Progress into a 25% bucket. Such as those between 0 and 25% are in 1, 26-50% in another, 51-75% in a third, and lastly 76-100%. Is there a DAX Calculation I can use to make this successful?

PrivateAnalytic_0-1668531540573.png

PrivateAnalytic_1-1668531723496.png

 

1 ACCEPTED SOLUTION
FreemanZ
Super User
Super User

Supposing your table named Data, try to add a column with the code below:
PctRange =
SWITCH(
    TRUE(),
    Data[% of PP Progress] <=0.25, "0-25%",
    Data[% of PP Progress] <=0.5, "26%-50%",
    Data[% of PP Progress] <=0.75, "51%-75%",
    "76%-100%"
)

View solution in original post

6 REPLIES 6
v-jayw-msft
Community Support
Community Support

Hi @PrivateAnalytic ,

 

Try a measure like below:

Measure =
var %Progress = sum([% of PP Progress])
Return
SWITCH(
    TRUE(),
    %Progress <= 0.25, 1,
    %Progress > 0.25 && %Progress < = 0.5, 2,
    %Progress > 0.5 && %Progress <=0.75, 3,
    4
)

 

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
FreemanZ
Super User
Super User

Supposing your table named Data, try to add a column with the code below:
PctRange =
SWITCH(
    TRUE(),
    Data[% of PP Progress] <=0.25, "0-25%",
    Data[% of PP Progress] <=0.5, "26%-50%",
    Data[% of PP Progress] <=0.75, "51%-75%",
    "76%-100%"
)

I got this error when I tried it <ccon>A circular dependency was detected: PP-Task Completion[% of PP Progress], PP-Task Completion[PctRange], PP-Task Completion[% of PP Progress].</ccon>

Rewrite your column as below:
% of PP Progress =
CALCULATE(
    DIVIDE(Data[Total Subtasks completed],17),
    ALLEXCEPT (Data[Total Subtasks completed])
)
Syk
Super User
Super User

You can group your data without DAX! Click the column you're wanting to group and under column tools > data groups > New data groups

Syk_0-1668532439368.png


Then you can toss those %s in buckets

I never knew this! When I tried to do it, I got this popup which I've never seen before. 

PrivateAnalytic_0-1668544621708.png

 

Helpful resources

Announcements
March Fabric Community Update

Fabric Community Update - March 2024

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

Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors