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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
arifulice09
Helper I
Helper I

Power BI calculated column Help

I have a data table (see the attached) , I am trying to get a calculated column based on some condition 

Condition( if all FeeType is Hourly for a particular project then for that project the result will be Hourly, if all is NoBilling then NoBilling else Fixed) but I am not getting the result.

e809dfb4-8f2c-4207-8ba9-887dd8f8f7a9.png

1 ACCEPTED SOLUTION
Samarth_18
Community Champion
Community Champion

Hi @arifulice09 ,

 

Create a column like this:-

Column_ = 
var _hourly = COUNTROWS(FILTER('Table (3)','Table (3)'[Feetype] = "Hourly" && 'Table (3)'[projectid] = EARLIER('Table (3)'[projectid])))

var _nobill = COUNTROWS(FILTER('Table (3)','Table (3)'[Feetype] = "NoBilling" && 'Table (3)'[projectid] = EARLIER('Table (3)'[projectid])))

var _proj = COUNTROWS(FILTER('Table (3)','Table (3)'[projectid] = EARLIER('Table (3)'[projectid])))

return SWITCH(TRUE(),
_hourly = _proj  ,"Hourly",
 _nobill = _proj,"No Biling",
"Fixed")

Output:-

Samarth_18_0-1645016223543.png

 

Thanks,

Samarth

 

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

View solution in original post

4 REPLIES 4
Samarth_18
Community Champion
Community Champion

Hi @arifulice09 ,

 

Create a column like this:-

Column_ = 
var _hourly = COUNTROWS(FILTER('Table (3)','Table (3)'[Feetype] = "Hourly" && 'Table (3)'[projectid] = EARLIER('Table (3)'[projectid])))

var _nobill = COUNTROWS(FILTER('Table (3)','Table (3)'[Feetype] = "NoBilling" && 'Table (3)'[projectid] = EARLIER('Table (3)'[projectid])))

var _proj = COUNTROWS(FILTER('Table (3)','Table (3)'[projectid] = EARLIER('Table (3)'[projectid])))

return SWITCH(TRUE(),
_hourly = _proj  ,"Hourly",
 _nobill = _proj,"No Biling",
"Fixed")

Output:-

Samarth_18_0-1645016223543.png

 

Thanks,

Samarth

 

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

@Samarth_18 thank you :-), its working fine.

goncalogeraldes
Super User
Super User

Hello there @arifulice09 ! Check if this works for you:

Desired Result =
SWITCH (
    TRUE (),
    DISTINCTCOUNT ( 'Table'[Feetype] ) > 1, "Fixed",
    SELECTEDVALUE ( 'Table'[Feetype] )
)

Hope this answer solves your problem!
If you need any additional help please @ me in your reply.
If my reply provided you with a solution, please consider marking it as a solution ✔️ or giving it a kudoe 👍
Thanks!

You can also check out my LinkedIn!

Best regards,
Gonçalo Geraldes

 

@goncalogeraldes Thanks for your reply, using the above code only giving the result of "Fixed" value.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.