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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register 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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.