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
ss8551
Helper II
Helper II

Have a Measure that I need to convert to a calculated Column

Hi, 

I have a Measure that works perfectly, however, I need to have this measure converted to a column so that I can add this to my Visualation.    Please note the Timeframe_1 is coming from a DirectQuery PBI.  All I really need is the if statement in the last two formulas to be a column so i can show post vs pre and/or calculate % of Post/Pre.

 

I currently have two columns:

Timeframe_1 = DATEDIFF('DirectQueryTable'[max_date],FIRSTDATE(Desktop_PBI[START_DT]),day)
Timeframe_2 = if([timeframe__1]>1,"Post-Training")
Timeframe_3 = if([timeframe__1]<=1,"Pre-training")

Would anyone know of a way to get the Timeframe measure into a calculated column so that i can add these to some visualtions?
 
When I attmept to put this data into a column the dateDiff changes and is no longer valid.
 
Any assistance is appreciated.
 
Thanks
1 ACCEPTED SOLUTION

@ss8551 

pls try this to create a column

Column = maxx(FILTER('Direct Query','Desktop PBI'[employee_ID]='Direct Query'[employee_ID]&&'Direct Query'[Course]=887744) ,'Direct Query'[comp_train])




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

16 REPLIES 16
ryan_mayu
Super User
Super User

could you pls provide the sample data and expected output?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Certainly.  The data is correct in the Measure I just need to have the same data in a column so it can be added to the visual.

 

Below is the data including the two Measures I'm hoping to convert

 

  Measure Measure
employee IDstart_dateTimeframeDateDiff
ab1234/1/2022Pre-Training-21
bc3454/8/2022Pre-Training-14
de6784/15/2022Pre-Training-7
fg9014/21/2022Pre-Training-1
hi2344/22/2022Post-Training3
jk5674/25/2022Post-Training6

 

Below is what I'd like in a Calculated Column:

 

Calculated Column Calculated Column
TimeframeDateDiff
Pre-Training-21
Pre-Training-14
Pre-Training-7
Pre-Training-1
Post-Training3
Post-Training6

 

Thank you

could you pls provide the sample data? if we dont know your data structure, we can't create the calculated column





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




I have a .pbix file that has the data, but while i have seen others upload thes to this site i don't see an option to do so.  when i try to drag and drop the attachement it doesn't allow .pbix files or .zip files.  please let me know how to upload this file to this site for you to be able to review.

 

Thanks

Is there a way to add a power bi attachement?  I don't see the option availble here.  i can add a PBI that should show this but not sure how. I only see options for adding media, photo, video, HTML, and Emoji's I don't see how to attach a PBI file.  Sorry, I'm fairly new to this board.

 

Thanks

you can use onedrive to share, or you can just create some dummy data and paste in the reply.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




ryan_mayu,

 

thank you for all of your assistance.  I was able to get this to work with what you sent me.  I apprecaite all of your assistance.

I've tried copy and paste of the pbi it didn't like it I had an error message I'll try again or try OneDrive

i can't open the link





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




please try the above file.  You should be able to open this file.  Sorry but it won't let me add a .PBIX file to this comment box.

@ss8551 

pls try this to create a column

Column = maxx(FILTER('Direct Query','Desktop PBI'[employee_ID]='Direct Query'[employee_ID]&&'Direct Query'[Course]=887744) ,'Direct Query'[comp_train])




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




That was what I needed.  Thank you so much!

you are welcome





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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.