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
mit1
Helper I
Helper I

MOD function not working?

mit1_0-1709775514553.png(Picture 1)

mit1_1-1709775827719.png(Picture 2)

 

Hi there, pardon my newbie question. THis graph was done in Power BI's DirectQuery mode.
My goal: Find the value of 'Customer2'[Body_V_P0_R] (aka voltage reading for customer 2) for every 4th reading.
What I did: Created and used my index column so that I can easily extract every 4th reading.

Problem: When I change the value in the MOD function from 10 (Picture 1) to 4 (Picture 2), this error appears. I've tested, for any number less than 10, this error appears.

Note: My values for Index are in whole numbers

My queries are:
1) What is causing this issue?
2) How should I solve it?
3) Is there any other way to reach my goal in DirectQuery?

Thanks a lot!

2 REPLIES 2
v-rongtiep-msft
Community Support
Community Support

Hi @mit1 ,

I've tried to reproduce your problem, but there are no errors.

vrongtiepmsft_1-1709863609659.png

 

According to the error message you provided: Unable to cast object of type System.Decimal to System.char.

  • This could be a data conversion issue, check your data source and the data types of the columns try to do it on a small sample of your data.

 

How to Get Your Question Answered Quickly - Microsoft Fabric Community

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Rongtie

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

 

 

 

 

 

 

 

Hi @v-rongtiep-msft ,

Thank you for your assitance! May I check if your experiment was done in DirectQuery mode?

My dashboard is done via DirectQuery which retrieves data from my database in azure.
---
I've tested it with the same code and same dataset in Import mode, there was no issue, it seems this problem I'm facing only surfaces in DirectQuery mode. Not sure why.

I've also tried it with my other columns, same error persists when the number is changed from 10 to <10.

mit1_0-1710131544016.png

 


---
My goal is to output the values of voltage for every 4th row (each row is generated every 5 mins).

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.