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
NoMansDax
Frequent Visitor

A calculated Column where fields are defined by a number in a different field

Hi all!

I'm new to the forums so I'm not sure if this kind of task has been adressed before.

 

I'm trying to create a column where the fields are given a status' depening on how many days it took for a ticket to be resolved (Each ticket corresponds to one row).
In PBI desktop I have created a calculated column based of two date columns (Submitted and resolved) which produces a number.
I want to have a new column where the field is defined by that number.
I'm hoping to end up with a table with a table that looks something like this:

 

Status201620172018
Same Day142
1  to 43512
5  to 10565
More Than 11653

 

(I'm aiming to use the matrix visual}

my formular looks like this and im not sure how far off the mark I am with the syntax

 

column =
(
IF([IvantiToCompletionDaysColumn]= (1<) , "Same Day", 0)
IF([IvantiToCompletionDaysColumn] = (1 <=> 4) ,"1 to 4", 0)
IF([IvantiToCompletionDaysColumn] = (5 <=> 10) ,"5 to 10", 0)
IF([IvantiToCompletionDaysColumn] > 11 ,"11+", 0)
)


Any help with this would be mightly appreciated

 

Cheers

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

Try this:

 

Category = 
SWITCH(
    TRUE(),
    [Days]<1, "Same Day",
    [Days]>=1 && [Days]<=4,"1 to 4",
    [Days]>=5 && [Days]<=10,"5 to 10",
    [Days]>=11,"11+"
)

[Days] would be your column of how many days open.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

2 REPLIES 2
Greg_Deckler
Super User
Super User

Try this:

 

Category = 
SWITCH(
    TRUE(),
    [Days]<1, "Same Day",
    [Days]>=1 && [Days]<=4,"1 to 4",
    [Days]>=5 && [Days]<=10,"5 to 10",
    [Days]>=11,"11+"
)

[Days] would be your column of how many days open.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Worked like magic!

thank you!

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.