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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

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
Anonymous
Not applicable

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 @Anonymous ,

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.